diff options
author | Dmitry Lomov <dslomov@google.com> | 2016-07-08 14:29:53 +0000 |
---|---|---|
committer | Kristina Chodorow <kchodorow@google.com> | 2016-07-11 09:39:14 +0000 |
commit | e2f9adab37975cc6565f218b26021afa0796e2fd (patch) | |
tree | 2cd959afd7ad6d4d959f54cdb63f176dc4b49694 /src/main/java/com/google/devtools/build/lib/shell | |
parent | 0aec8b2e6d199112edfa09b3ef0cb1095437b02a (diff) |
Fix capturing stdin/stdout on Windows.
1. Return EOF for streams representing Windows process pipes.
2. Fix the timing of process.close()
3. Un-synchronized reading of stderr and stdout.
--
Change-Id: Iec98f45db9984be2c2b066962801cbd3ca60da3f
Reviewed-on: https://bazel-review.googlesource.com/#/c/4000/
MOS_MIGRATED_REVID=126910063
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/shell')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/shell/Command.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/shell/Command.java b/src/main/java/com/google/devtools/build/lib/shell/Command.java index 84f78d2ae3..79b850acad 100644 --- a/src/main/java/com/google/devtools/build/lib/shell/Command.java +++ b/src/main/java/com/google/devtools/build/lib/shell/Command.java @@ -819,9 +819,6 @@ public final class Command { TerminationStatus status = waitForProcess(process, killSubprocessOnInterrupt); observer.stopObserving(processKillable); - // #close() must be called after the #stopObserving() so that a badly-timed timeout does not - // try to destroy a process that is already closed - process.close(); log.finer(status.toString()); @@ -849,6 +846,11 @@ public final class Command { : new AbnormalTerminationException(this, noOutputResult, message, ioe); } + } finally { + // #close() must be called after the #stopObserving() so that a badly-timed timeout does not + // try to destroy a process that is already closed, and after outErr is completed, + // so that it has a chance to read the entire output is captured. + process.close(); } CommandResult result = |