Background processes won't set the return code, so don't allow it to be queried.
This commit is contained in:
parent
688f2f47f1
commit
60444bb7f8
1 changed files with 6 additions and 5 deletions
|
@ -28,7 +28,7 @@ import java.util.Map;
|
||||||
*/
|
*/
|
||||||
public class CommandRunner {
|
public class CommandRunner {
|
||||||
|
|
||||||
private int returnCode;
|
private Integer returnCode;
|
||||||
private String stdOut = "";
|
private String stdOut = "";
|
||||||
private String stdErr = "";
|
private String stdErr = "";
|
||||||
private File workingDirectory;
|
private File workingDirectory;
|
||||||
|
@ -121,10 +121,8 @@ public class CommandRunner {
|
||||||
}
|
}
|
||||||
|
|
||||||
Process process = builder.start();
|
Process process = builder.start();
|
||||||
StreamEater outputEater = new StreamEater(process.getInputStream(),
|
new StreamEater(process.getInputStream(), false);
|
||||||
false);
|
new StreamEater(process.getErrorStream(), true);
|
||||||
StreamEater errorEater = new StreamEater(process.getErrorStream(),
|
|
||||||
true);
|
|
||||||
|
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
throw new CommandRunnerException(
|
throw new CommandRunnerException(
|
||||||
|
@ -133,6 +131,9 @@ public class CommandRunner {
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getReturnCode() {
|
public int getReturnCode() {
|
||||||
|
if (returnCode == null) {
|
||||||
|
throw new IllegalStateException("Return code is not available.");
|
||||||
|
}
|
||||||
return returnCode;
|
return returnCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue