Shellbox
Library and server for containerized shell execution
Loading...
Searching...
No Matches
Shellbox\Command\BoxedResult Class Reference

Class representing the result of running a BoxedCommand. More...

+ Inheritance diagram for Shellbox\Command\BoxedResult:

Public Member Functions

 addOutputFile ( $name, OutputFile $outputFile)
 Add an output file to the result.
 
 getFileContents ( $name)
 Get the contents of an output file as a string.
 
 wasReceived ( $name)
 Query whether an output file was received.
 
 wasGenerated ( $name)
 Query whether an output file was generated by the command.
 
 getFileNames ()
 Get the names of all files which were registered and were created by the command.
 
 getReceivedFileNames ()
 Get the names of all files which were received.
 
 getUploadedFileNames ()
 Get the names of all files which were uploaded.
 
- Public Member Functions inherited from Shellbox\Command\UnboxedResult
 exitCode ( $exitCode)
 Set the exit code.
 
 stdout ( $stdout)
 Set the stdout contents.
 
 stderr ( $stderr)
 Set the stderr contents.
 
 merge (UnboxedResult $other)
 Combine another result with this one.
 
 getExitCode ()
 Returns exit code of the process.
 
 getStdout ()
 Returns stdout of the process.
 
 getStderr ()
 Returns stderr of the process or null if the Command was configured to add stderr to stdout with includeStderr( true )
 

Detailed Description

Class representing the result of running a BoxedCommand.

Member Function Documentation

◆ getFileContents()

Shellbox\Command\BoxedResult::getFileContents ( $name)

Get the contents of an output file as a string.

Parameters
string$nameThe file name relative to the working directory
Returns
string|null The contents, or null if the command did not create a file of that name, or if the output file was not registered in the BoxedCommand.

◆ getFileNames()

Shellbox\Command\BoxedResult::getFileNames ( )

Get the names of all files which were registered and were created by the command.

Returns
string[]

Reimplemented in Shellbox\Command\ServerBoxedResult.

◆ getReceivedFileNames()

Shellbox\Command\BoxedResult::getReceivedFileNames ( )

Get the names of all files which were received.

This is all generated files except for uploaded files.

Since
4.1.0
Returns
string[]

Reimplemented in Shellbox\Command\ServerBoxedResult.

◆ getUploadedFileNames()

Shellbox\Command\BoxedResult::getUploadedFileNames ( )

Get the names of all files which were uploaded.

Since
4.1.0
Returns
string[]

◆ wasGenerated()

Shellbox\Command\BoxedResult::wasGenerated ( $name)

Query whether an output file was generated by the command.

Since
4.1.0
Parameters
string$name
Returns
bool

◆ wasReceived()

Shellbox\Command\BoxedResult::wasReceived ( $name)

Query whether an output file was received.

Files that are uploaded to a URL are not included in this.

Parameters
string$name
Returns
bool

The documentation for this class was generated from the following file: