aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools/build
diff options
context:
space:
mode:
authorGravatar Eric Fellheimer <felly@google.com>2016-02-19 15:48:42 +0000
committerGravatar Lukacs Berki <lberki@google.com>2016-02-22 16:04:22 +0000
commit9a6c2ebc0888840247247d5d03d715440aee985f (patch)
tree46be359595310e982a5a7c88d9891097b3a2fda9 /src/main/java/com/google/devtools/build
parent2fd0506bc77d541cb8496098f12bc1a8da724503 (diff)
Allow async command invocations to set the "closeOutput" bit.
-- MOS_MIGRATED_REVID=115063418
Diffstat (limited to 'src/main/java/com/google/devtools/build')
-rw-r--r--src/main/java/com/google/devtools/build/lib/shell/Command.java13
1 files changed, 11 insertions, 2 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 794be920e9..1301fa1780 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 @@ public final class Command {
* 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 final class Command {
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 @@ public final class Command {
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 -------------------------------------------------------