diff options
author | 2018-02-05 07:59:13 -0800 | |
---|---|---|
committer | 2018-02-05 08:01:17 -0800 | |
commit | 4741aa83145fd2d3ab0599314f7732c5b80977bd (patch) | |
tree | b33310e226d9733ae0e538e433a54e337d6a67ed /src/main/java/com/google/devtools/build/lib/runtime/commands/CleanCommand.java | |
parent | 03ad9155f765fcdc0ccf4aae30a4def9914ea0b4 (diff) |
Add a "direct" mode to "blaze run" that makes the process being run a direct
child of the process where the Blaze client itself was run.
Limitations:
- Untested on Windows; it should work because ExecuteProgram() is implemented there, too, but since Windows doesn't support exec(), there is at least one process in between
Progress towards #2815.
RELNOTES[NEW]: The new "--direct_run" flag on "blaze run" lets one run interactive binaries.
PiperOrigin-RevId: 184528845
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/runtime/commands/CleanCommand.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/runtime/commands/CleanCommand.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/runtime/commands/CleanCommand.java b/src/main/java/com/google/devtools/build/lib/runtime/commands/CleanCommand.java index 721a0644fc..bf88f451a0 100644 --- a/src/main/java/com/google/devtools/build/lib/runtime/commands/CleanCommand.java +++ b/src/main/java/com/google/devtools/build/lib/runtime/commands/CleanCommand.java @@ -21,6 +21,7 @@ import com.google.devtools.build.lib.buildtool.OutputDirectoryLinksUtils; import com.google.devtools.build.lib.events.Event; import com.google.devtools.build.lib.runtime.BlazeCommand; import com.google.devtools.build.lib.runtime.BlazeCommandDispatcher.ShutdownBlazeServerException; +import com.google.devtools.build.lib.runtime.BlazeCommandResult; import com.google.devtools.build.lib.runtime.Command; import com.google.devtools.build.lib.runtime.CommandEnvironment; import com.google.devtools.build.lib.shell.CommandException; @@ -127,7 +128,7 @@ public final class CleanCommand implements BlazeCommand { private static final Logger logger = Logger.getLogger(CleanCommand.class.getName()); @Override - public ExitCode exec(CommandEnvironment env, OptionsProvider options) + public BlazeCommandResult exec(CommandEnvironment env, OptionsProvider options) throws ShutdownBlazeServerException { Options cleanOptions = options.getOptions(Options.class); boolean async = cleanOptions.async; @@ -165,16 +166,16 @@ public final class CleanCommand implements BlazeCommand { .getOptions(BuildRequestOptions.class) .getSymlinkPrefix(env.getRuntime().getProductName()); actuallyClean(env, env.getOutputBase(), cleanOptions.expunge, async, symlinkPrefix); - return ExitCode.SUCCESS; + return BlazeCommandResult.exitCode(ExitCode.SUCCESS); } catch (IOException e) { env.getReporter().handle(Event.error(e.getMessage())); - return ExitCode.LOCAL_ENVIRONMENTAL_ERROR; + return BlazeCommandResult.exitCode(ExitCode.LOCAL_ENVIRONMENTAL_ERROR); } catch (CommandException | ExecException e) { env.getReporter().handle(Event.error(e.getMessage())); - return ExitCode.RUN_FAILURE; + return BlazeCommandResult.exitCode(ExitCode.RUN_FAILURE); } catch (InterruptedException e) { env.getReporter().handle(Event.error("clean interrupted")); - return ExitCode.INTERRUPTED; + return BlazeCommandResult.exitCode(ExitCode.INTERRUPTED); } } @@ -265,7 +266,7 @@ public final class CleanCommand implements BlazeCommand { // shutdown on expunge cleans if (expunge) { - throw new ShutdownBlazeServerException(0); + throw new ShutdownBlazeServerException(ExitCode.SUCCESS); } System.gc(); } |