Allow async command invocations to set the "closeOutput" bit.
--
MOS_MIGRATED_REVID=115063418
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 794be92..1301fa1 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
@@ -622,6 +622,7 @@
* E.g., you could pass {@link System#out} as <code>stdOut</code>.
* @param stdErr the process will write its standard error into this stream.
* E.g., you could pass {@link System#err} as <code>stdErr</code>.
+ * @param closeOutput whether to close stdout / stderr when the process closes its output streams.
* @return An object that can be used to check if the process terminated and
* obtain the process results.
* @throws ExecFailedException if {@link Runtime#exec(String[])} fails for any
@@ -631,7 +632,8 @@
public FutureCommandResult executeAsynchronously(final InputStream stdinInput,
final KillableObserver observer,
final OutputStream stdOut,
- final OutputStream stdErr)
+ final OutputStream stdErr,
+ final boolean closeOutput)
throws CommandException {
// supporting "null" here for backwards compatibility
final KillableObserver theObserver =
@@ -640,7 +642,14 @@
return doExecute(new InputStreamInputSource(stdinInput),
theObserver,
Consumers.createStreamingConsumers(stdOut, stdErr),
- /*killSubprocess=*/false, /*closeOutput=*/false);
+ /*killSubprocess=*/false, closeOutput);
+ }
+ public FutureCommandResult executeAsynchronously(final InputStream stdinInput,
+ final KillableObserver observer,
+ final OutputStream stdOut,
+ final OutputStream stdErr)
+ throws CommandException {
+ return executeAsynchronously(stdinInput, observer, stdOut, stdErr, /*closeOutput=*/false);
}
// End of public API -------------------------------------------------------