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 {
|
||||
|
||||
private int returnCode;
|
||||
private Integer returnCode;
|
||||
private String stdOut = "";
|
||||
private String stdErr = "";
|
||||
private File workingDirectory;
|
||||
|
@ -121,10 +121,8 @@ public class CommandRunner {
|
|||
}
|
||||
|
||||
Process process = builder.start();
|
||||
StreamEater outputEater = new StreamEater(process.getInputStream(),
|
||||
false);
|
||||
StreamEater errorEater = new StreamEater(process.getErrorStream(),
|
||||
true);
|
||||
new StreamEater(process.getInputStream(), false);
|
||||
new StreamEater(process.getErrorStream(), true);
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new CommandRunnerException(
|
||||
|
@ -133,6 +131,9 @@ public class CommandRunner {
|
|||
}
|
||||
|
||||
public int getReturnCode() {
|
||||
if (returnCode == null) {
|
||||
throw new IllegalStateException("Return code is not available.");
|
||||
}
|
||||
return returnCode;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue