Rollback of commit 1e37a5375f918376c132fa537e25695f673f41b8.
*** Reason for rollback ***
Apparently we now try to open output files for the process twice: once when we are constructing the output streams, and the second time when we tell the process to redirect its outputs. This causes the outputs to be empty on Windows
*** Original change description ***
Do redirection of stdout / stderr in Java instead of reimplementing it in every process wrapper again.
--
MOS_MIGRATED_REVID=126801016
diff --git a/src/test/java/com/google/devtools/build/lib/standalone/StandaloneSpawnStrategyTest.java b/src/test/java/com/google/devtools/build/lib/standalone/StandaloneSpawnStrategyTest.java
index 6d20ba7..580bff9 100644
--- a/src/test/java/com/google/devtools/build/lib/standalone/StandaloneSpawnStrategyTest.java
+++ b/src/test/java/com/google/devtools/build/lib/standalone/StandaloneSpawnStrategyTest.java
@@ -39,10 +39,10 @@
import com.google.devtools.build.lib.rules.apple.AppleConfiguration;
import com.google.devtools.build.lib.testutil.BlazeTestUtils;
import com.google.devtools.build.lib.testutil.TestConstants;
+import com.google.devtools.build.lib.testutil.TestFileOutErr;
import com.google.devtools.build.lib.testutil.TestUtils;
import com.google.devtools.build.lib.util.BlazeClock;
import com.google.devtools.build.lib.util.OS;
-import com.google.devtools.build.lib.util.io.FileOutErr;
import com.google.devtools.build.lib.vfs.FileSystem;
import com.google.devtools.build.lib.vfs.FileSystemUtils;
import com.google.devtools.build.lib.vfs.Path;
@@ -66,7 +66,6 @@
private Reporter reporter = new Reporter(PrintingEventHandler.ERRORS_AND_WARNINGS_TO_STDERR);
private BlazeExecutor executor;
private FileSystem fileSystem;
- private FileOutErr outErr;
private Path createTestRoot() throws IOException {
fileSystem = FileSystems.getNativeFileSystem();
@@ -86,9 +85,6 @@
Path workspaceDir = testRoot.getRelative(TestConstants.WORKSPACE_NAME);
workspaceDir.createDirectory();
- outErr =
- new FileOutErr(testRoot.getRelative("test_out.log"), testRoot.getRelative("test_err.log"));
-
// setup output base & directories
Path outputBase = testRoot.getRelative("outputBase");
outputBase.createDirectory();
@@ -123,6 +119,8 @@
new ActionsTestUtil.NullAction());
}
+ private TestFileOutErr outErr = new TestFileOutErr();
+
private String out() {
return outErr.outAsLatin1();
}
@@ -142,7 +140,6 @@
private void run(Spawn spawn) throws Exception {
executor.getSpawnActionContext(spawn.getMnemonic()).exec(spawn, createContext());
}
-
private ActionExecutionContext createContext() {
Path execRoot = executor.getExecRoot();
return new ActionExecutionContext(