use of org.springframework.boot.loader.tools.RunProcess in project spring-boot by spring-projects.
the class StartMojo method runProcess.
private RunProcess runProcess(File workingDirectory, List<String> args) throws MojoExecutionException {
try {
RunProcess runProcess = new RunProcess(workingDirectory, new JavaExecutable().toString());
runProcess.run(false, args.toArray(new String[args.size()]));
return runProcess;
} catch (Exception ex) {
throw new MojoExecutionException("Could not exec java", ex);
}
}
use of org.springframework.boot.loader.tools.RunProcess in project spring-boot by spring-projects.
the class RunProcessCommand method run.
protected ExitStatus run(Collection<String> args) throws IOException {
this.process = new RunProcess(this.command);
int code = this.process.run(true, args.toArray(new String[args.size()]));
if (code == 0) {
return ExitStatus.OK;
} else {
return new ExitStatus(code, "EXTERNAL_ERROR");
}
}
use of org.springframework.boot.loader.tools.RunProcess in project spring-boot by spring-projects.
the class RunMojo method runWithForkedJvm.
@Override
protected void runWithForkedJvm(File workingDirectory, List<String> args) throws MojoExecutionException {
try {
RunProcess runProcess = new RunProcess(workingDirectory, new JavaExecutable().toString());
Runtime.getRuntime().addShutdownHook(new Thread(new RunProcessKiller(runProcess)));
int exitCode = runProcess.run(true, args.toArray(new String[args.size()]));
if (exitCode == 0 || exitCode == EXIT_CODE_SIGINT) {
return;
}
throw new MojoExecutionException("Application finished with exit code: " + exitCode);
} catch (Exception ex) {
throw new MojoExecutionException("Could not exec java", ex);
}
}
Aggregations