Background processes won't set the return code, so don't allow it to be queried.

This commit is contained in:
jeb228 2010-08-18 16:33:33 +00:00
parent 688f2f47f1
commit 60444bb7f8

View file

@ -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;
}