Add ExitStatus to Command.run()
The main difference for now is the removal of the --nohup (slightly hacky) option in TestCommand. Now a TestCommand can signal to its caller that it wants to be hung up. Fixes gh-975
This commit is contained in:
@@ -48,11 +48,11 @@ public class RunProcess {
|
||||
this.command = command;
|
||||
}
|
||||
|
||||
public void run(String... args) throws IOException {
|
||||
run(Arrays.asList(args));
|
||||
public int run(String... args) throws IOException {
|
||||
return run(Arrays.asList(args));
|
||||
}
|
||||
|
||||
protected void run(Collection<String> args) throws IOException {
|
||||
protected int run(Collection<String> args) throws IOException {
|
||||
ProcessBuilder builder = new ProcessBuilder(this.command);
|
||||
builder.command().addAll(args);
|
||||
builder.redirectErrorStream(true);
|
||||
@@ -74,6 +74,12 @@ public class RunProcess {
|
||||
catch (InterruptedException ex) {
|
||||
Thread.currentThread().interrupt();
|
||||
}
|
||||
try {
|
||||
return this.process.exitValue();
|
||||
}
|
||||
catch (IllegalThreadStateException e) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
finally {
|
||||
this.endTime = System.currentTimeMillis();
|
||||
|
||||
Reference in New Issue
Block a user