diff options
author | 2016-08-29 19:10:53 +0000 | |
---|---|---|
committer | 2016-08-30 08:34:16 +0000 | |
commit | c3386bf9fd5ce99ea4c5a4f438cda6b04c6c3e9c (patch) | |
tree | 2300d37accc57b0342f62c5ad4555c376206a72c /src/main/java/com/google/devtools/build | |
parent | a32a70ccdcd79dd9f8820963fd7568d269d21138 (diff) |
Expose killSubprocessOnInterrupt on Command#executeAsynchronously
--
MOS_MIGRATED_REVID=131620345
Diffstat (limited to 'src/main/java/com/google/devtools/build')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/shell/Command.java | 15 |
1 files changed, 12 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 9f35d69664..d0571154af 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 @@ -17,7 +17,6 @@ package com.google.devtools.build.lib.shell; import com.google.common.collect.ImmutableList; import com.google.devtools.build.lib.shell.SubprocessBuilder.StreamAction; - import java.io.File; import java.io.IOException; import java.io.InputStream; @@ -645,6 +644,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 killSubprocessOnInterrupt whether or not to kill the created process on interrupt * @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. @@ -656,6 +656,7 @@ public final class Command { final KillableObserver observer, final OutputStream stdOut, final OutputStream stdErr, + final boolean killSubprocessOnInterrupt, final boolean closeOutput) throws CommandException { // supporting "null" here for backwards compatibility @@ -665,14 +666,22 @@ public final class Command { return doExecute(new InputStreamInputSource(stdinInput), theObserver, Consumers.createStreamingConsumers(stdOut, stdErr), - /*killSubprocess=*/false, closeOutput); + killSubprocessOnInterrupt, + 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); + return executeAsynchronously( + stdinInput, + observer, + stdOut, + stdErr, + /*killSubprocess=*/ false, + /*closeOutput=*/ false); } // End of public API ------------------------------------------------------- |