Package org.codehaus.groovy.runtime
Class ProcessResult
java.lang.Object
org.codehaus.groovy.runtime.ProcessResult
Captures the result of executing an external process, including
the standard output, standard error, and exit code.
def result = "ls -la".execute().waitForResult() assert result.ok println result.out
- Since:
- 6.0.0
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionProcessResult(String out, String err, int exitCode) Constructs a ProcessResult with the specified output, error, and exit code. -
Method Summary
Modifier and TypeMethodDescriptiongetErr()Returns the standard error of the process as a String.intReturns the exit code of the process.getOut()Returns the standard output of the process as a String.booleanisOk()Returnstrueif the process exited with code 0.toString()Returns a string representation of this process result, including the exit code and abbreviated output/error.
-
Constructor Details
-
ProcessResult
Constructs a ProcessResult with the specified output, error, and exit code.- Parameters:
out- the standard output of the processerr- the standard error of the processexitCode- the process exit code
-
-
Method Details
-
getOut
Returns the standard output of the process as a String. -
getErr
Returns the standard error of the process as a String. -
getExitCode
public int getExitCode()Returns the exit code of the process. -
isOk
public boolean isOk()Returnstrueif the process exited with code 0. -
toString
Returns a string representation of this process result, including the exit code and abbreviated output/error.
-