From 60444bb7f85640a9b57137e76e26f461aac9ea59 Mon Sep 17 00:00:00 2001 From: jeb228 Date: Wed, 18 Aug 2010 16:33:33 +0000 Subject: [PATCH] Background processes won't set the return code, so don't allow it to be queried. --- .../vitro/utilities/testrunner/CommandRunner.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/utilities/testrunner/src/edu/cornell/mannlib/vitro/utilities/testrunner/CommandRunner.java b/utilities/testrunner/src/edu/cornell/mannlib/vitro/utilities/testrunner/CommandRunner.java index f54554a51..1d44999e2 100644 --- a/utilities/testrunner/src/edu/cornell/mannlib/vitro/utilities/testrunner/CommandRunner.java +++ b/utilities/testrunner/src/edu/cornell/mannlib/vitro/utilities/testrunner/CommandRunner.java @@ -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; }