ShellProcessBuilder now returns exit value of process

This commit is contained in:
nathan 2016-02-20 18:08:23 +01:00
parent 60b12d4036
commit 357895cc79
2 changed files with 11 additions and 5 deletions

View File

@ -200,7 +200,7 @@ class JavaProcessBuilder extends ShellProcessBuilder {
@Override @Override
public public
void start() { int start() {
setExecutable(this.javaLocation); setExecutable(this.javaLocation);
// save off the original arguments // save off the original arguments
@ -267,6 +267,6 @@ class JavaProcessBuilder extends ShellProcessBuilder {
this.arguments.addAll(origArguments); this.arguments.addAll(origArguments);
super.start(); return super.start();
} }
} }

View File

@ -162,7 +162,7 @@ class ShellProcessBuilder {
public public
void start() { int start() {
List<String> argumentsList = new ArrayList<String>(); List<String> argumentsList = new ArrayList<String>();
// if no executable, then use the command shell // if no executable, then use the command shell
@ -403,11 +403,12 @@ class ShellProcessBuilder {
} }
} }
int exitValue = 0;
try { try {
this.process.waitFor(); this.process.waitFor();
@SuppressWarnings("unused") exitValue = this.process.exitValue();
int exitValue = this.process.exitValue();
// wait for the READER threads to die (meaning their streams have closed/EOF'd) // wait for the READER threads to die (meaning their streams have closed/EOF'd)
if (writeToProcess_input != null) { if (writeToProcess_input != null) {
@ -434,7 +435,12 @@ class ShellProcessBuilder {
// remove the shutdown hook now that we've shutdown. // remove the shutdown hook now that we've shutdown.
Runtime.getRuntime() Runtime.getRuntime()
.removeShutdownHook(hook); .removeShutdownHook(hook);
return exitValue;
} }
// 1 means a problem
return 1;
} }
/** /**