The shellCommand Object
The shellCommand object contains the results from a command line execution.
On MS Windows platforms, the shell command will start, but you will not be
able to get output/status from it.
Methods
Function |
Description |
getExitValue() |
Returns the exit code from the command line |
getOutputBuffer() |
Returns the output from the command line as a
string |
getErrorBuffer() |
Returns the error output from the command line
as a string |
getInputStream() |
Returns the command line's input stream as an
java.io.InputStream object. You can use this to pipe input to a command. |
getError() |
Returns the exception if the command line
failed |
failed () |
Returns true if the command line execution
failed |
Example
var cmd = system.shellCommand ("/bin/ls -l");
if ( cmd.failed() ) {
task.logmsg ( "Command failed: " + cmd.getError());
} else {
task.logmsg ( cmd.getOutputBuffer() );
}
|