Package edu.odu.cs.zeil.codegrader
Class ExternalProcess
- java.lang.Object
-
- edu.odu.cs.zeil.codegrader.ExternalProcess
-
-
Field Summary
-
Fields inherited from interface edu.odu.cs.zeil.codegrader.TCProcess
IS_WINDOWS
-
-
Constructor Summary
Constructors Constructor Description ExternalProcess(java.nio.file.Path cwd, java.lang.String commandLine, int timeLimit, java.io.File stdInFile, java.lang.String description)Create a external process runner.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancrashed()Did the prior execution exit with a non-zero status code?voidexecute()Runs the external command.voidexecute(boolean quiet)Runs the external command.java.lang.StringgetErr()Return the captured error stream.booleangetOnTime()java.lang.StringgetOutput()Return the captured output.intgetStatusCode()intgetTime()Time in seconds of execution.booleantimedOut()Did the prior execution go too long?
-
-
-
Constructor Detail
-
ExternalProcess
public ExternalProcess(java.nio.file.Path cwd, java.lang.String commandLine, int timeLimit, java.io.File stdInFile, java.lang.String description)Create a external process runner.- Parameters:
cwd- working directory in which to run the processcommandLine- the command to runtimeLimit- max time in seconds to allow this to runstdInFile- file to supply as standard input. Null if no input is desired.description- description of the process (used only in error messages and log entries). If "", uses commandLine.
-
-
Method Detail
-
execute
public void execute(boolean quiet)
Runs the external command. Standard out and standard err are captured and available as getOutput() and getErr(). The status code is also available.
-
execute
public void execute()
Runs the external command. Equivalent to execute(false);
-
getOutput
public java.lang.String getOutput()
Return the captured output.
-
getErr
public java.lang.String getErr()
Return the captured error stream.
-
getTime
public int getTime()
Time in seconds of execution.
-
timedOut
public boolean timedOut()
Did the prior execution go too long?
-
crashed
public boolean crashed()
Did the prior execution exit with a non-zero status code?
-
getOnTime
public boolean getOnTime()
-
getStatusCode
public int getStatusCode()
- Specified by:
getStatusCodein interfaceTCProcess- Returns:
- status code of last execution (usually 0 if successful)
-
-