Package com.tnsai.quality.sandbox
Record Class SandboxResult
java.lang.Object
java.lang.Record
com.tnsai.quality.sandbox.SandboxResult
- Record Components:
exitCode- process exit code;0= success by convention.-1reserved for "killed by the sandbox before producing an exit code" (timeout, OOM, terminate while running).stdout- stdout bytes (UTF-8 decoded bystdoutString())stderr- stderr bytesresourceUsage- post-execution accountingtimedOut-trueif the sandbox killed the process because it exceededResourceLimits.timeoutoutputTruncated-trueif stdout+stderr hitResourceLimits.maxOutputBytesand the process was killed
public record SandboxResult(int exitCode, byte[] stdout, byte[] stderr, ResourceUsage resourceUsage, boolean timedOut, boolean outputTruncated)
extends Record
Outcome of a single
Sandbox.execute(com.tnsai.quality.sandbox.Command) call (TNS-296).- Since:
- 0.10.0 (TNS-296)
-
Constructor Summary
ConstructorsConstructorDescriptionSandboxResult(int exitCode, byte[] stdout, byte[] stderr, ResourceUsage resourceUsage, boolean timedOut) Source-compatible 5-arg constructor — capture was not truncated.SandboxResult(int exitCode, byte[] stdout, byte[] stderr, ResourceUsage resourceUsage, boolean timedOut, boolean outputTruncated) Creates an instance of aSandboxResultrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.intexitCode()Returns the value of theexitCoderecord component.final inthashCode()Returns a hash code value for this object.booleanReturns the value of theoutputTruncatedrecord component.Returns the value of theresourceUsagerecord component.byte[]stderr()Returns the value of thestderrrecord component.UTF-8 stderr view.byte[]stdout()Returns the value of thestdoutrecord component.UTF-8 stdout view — the common-case accessor.booleansuccess()trueif the process exited with a zero status and was not killed by the sandbox enforcement layer.booleantimedOut()Returns the value of thetimedOutrecord component.final StringtoString()Returns a string representation of this record class.
-
Constructor Details
-
SandboxResult
public SandboxResult(int exitCode, byte[] stdout, byte[] stderr, ResourceUsage resourceUsage, boolean timedOut, boolean outputTruncated) Creates an instance of aSandboxResultrecord class.- Parameters:
exitCode- the value for theexitCoderecord componentstdout- the value for thestdoutrecord componentstderr- the value for thestderrrecord componentresourceUsage- the value for theresourceUsagerecord componenttimedOut- the value for thetimedOutrecord componentoutputTruncated- the value for theoutputTruncatedrecord component
-
SandboxResult
public SandboxResult(int exitCode, byte[] stdout, byte[] stderr, ResourceUsage resourceUsage, boolean timedOut) Source-compatible 5-arg constructor — capture was not truncated.
-
-
Method Details
-
stdoutString
UTF-8 stdout view — the common-case accessor. -
stderrString
UTF-8 stderr view. -
success
public boolean success()trueif the process exited with a zero status and was not killed by the sandbox enforcement layer. -
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
exitCode
public int exitCode()Returns the value of theexitCoderecord component.- Returns:
- the value of the
exitCoderecord component
-
stdout
public byte[] stdout()Returns the value of thestdoutrecord component.- Returns:
- the value of the
stdoutrecord component
-
stderr
public byte[] stderr()Returns the value of thestderrrecord component.- Returns:
- the value of the
stderrrecord component
-
resourceUsage
Returns the value of theresourceUsagerecord component.- Returns:
- the value of the
resourceUsagerecord component
-
timedOut
public boolean timedOut()Returns the value of thetimedOutrecord component.- Returns:
- the value of the
timedOutrecord component
-
outputTruncated
public boolean outputTruncated()Returns the value of theoutputTruncatedrecord component.- Returns:
- the value of the
outputTruncatedrecord component
-