Skip to main content
See Commands for usage examples.

Sandbox

sandbox.exec()

Run an executable and collect its output. Shell syntax is not interpreted. Ruby does not expose streaming execution handles.

Parameters

commandString
Executable to run.
argsArray<String>
Command arguments; defaults to an empty array.
cwdString
Guest working directory.
userString
Guest user.
envHash
Environment variables.
timeoutNumeric
Finite, non-negative timeout in seconds.
stdinString | :null | :pipe
Input bytes or stdin mode. Ruby does not expose a writable streaming handle.
ttyBoolean
Allocate a pseudo-terminal.
rlimitsHash
Resource names mapped to non-negative integer limits.

Returns

ExecOutput
Collected stdout, stderr, and exit status.

sandbox.shell()

Run a script through the sandbox’s configured shell. Accepts the same per-call options as exec().

Parameters

scriptString
Shell script to execute.
optionsHash
The cwd, user, env, timeout, stdin, tty, and rlimits options documented above.

Returns

ExecOutput
Collected stdout, stderr, and exit status.

sandbox.logs()

Collect log entries from the connected sandbox. This does not subscribe to a stream.

Parameters

tailInteger
Optional maximum number of recent entries.
sourcesArray<Symbol | String>
Optional filter: stdout, stderr, output, or system.

Returns

Array<LogEntry>
Collected log entries.

ExecOutput

output.stdout

Returns

String
Collected output bytes.

output.stderr

Returns

String
Collected output bytes.

output.stdout_bytes

Returns

String
Binary output aliases.

output.stderr_bytes

Returns

String
Binary output aliases.

output.exit_code

Returns

Integer
Process exit code.

output.success?

Returns

Boolean
Whether execution succeeded.

output.to_h()

Returns

Hash
String keys: stdout, stderr, exit_code, success.

LogEntry

entry.timestamp

Returns

String
RFC 3339 timestamp

entry.source

Returns

String
Log source

entry.data

Returns

String
Raw log bytes

entry.to_h()

Returns

Hash
String keys matching the members above