use of com.facebook.buck.util.ProcessExecutor.Option in project buck by facebook.
the class ShellStep method launchAndInteractWithProcess.
@VisibleForTesting
int launchAndInteractWithProcess(ExecutionContext context, ProcessExecutorParams params) throws InterruptedException, IOException {
ImmutableSet.Builder<Option> options = ImmutableSet.builder();
addOptions(context, options);
ProcessExecutor executor = context.getProcessExecutor();
ProcessExecutor.Result result = executor.launchAndExecute(params, options.build(), getStdin(context), getTimeout(), getTimeoutHandler(context));
stdout = result.getStdout();
stderr = result.getStderr();
Verbosity verbosity = context.getVerbosity();
if (stdout.isPresent() && !stdout.get().isEmpty() && (result.getExitCode() != 0 || shouldPrintStdout(verbosity))) {
context.postEvent(ConsoleEvent.info("%s", stdout.get()));
}
if (stderr.isPresent() && !stderr.get().isEmpty() && (result.getExitCode() != 0 || shouldPrintStderr(verbosity))) {
context.postEvent(ConsoleEvent.warning("%s", stderr.get()));
}
return getExitCodeFromResult(context, result);
}
Aggregations