Class - Command
A command executed in a Sandbox.
You can wait on commands to access their CommandFinished.exitCode, and iterate over their output with logs.
See
Sandbox.runCommand to start a command.
Extended by
Accessors
cmdId
Get Signature
ID of the command execution.
Returns
string
Methods
logs()
Iterate over the output of this command.
Returns
AsyncIterable
<{
stream
: "stdout"
| "stderr"
;
data
: string
;
}, any
, any
>
An async iterable of log entries from the command output.
See
Command.stdout, Command.stderr, and Command.output to access output as a string.
wait()
Wait for a command to exit and populate its exit code.
Returns
Promise
<CommandFinished
>
A CommandFinished instance with populated exit code.
output()
Get the output of stdout
, stderr
, or both as a string.
NOTE: This may throw string conversion errors if the command does not output valid Unicode.
Parameters
Parameter | Type | Default value | Description |
---|---|---|---|
stream | "stdout" | "stderr" | "both" | "both" | The output stream to read: “stdout”, “stderr”, or “both”. |
Returns
Promise
<string
>
The output of the specified stream(s) as a string.
stdout()
Get the output of stdout
as a string.
NOTE: This may throw string conversion errors if the command does not output valid Unicode.
Returns
Promise
<string
>
The standard output of the command.
stderr()
Get the output of stderr
as a string.
NOTE: This may throw string conversion errors if the command does not output valid Unicode.
Returns
Promise
<string
>
The standard error output of the command.
kill()
Kill a running command in a sandbox.
Parameters
Parameter | Type |
---|---|
signal? | Signal |
Returns
Promise
<void
>
Promise<void>
.