CommandInputHandle
An ordered, long-lived input handle for a command or PTY.Methods
close()
Returns
Promise<void>
A promise that resolves when envd acknowledges the end of the input stream.
Throws
If the command or PTY does not exist.Throws
If the input stream times out.send()
Parameters
Returns
Promise<void>
A promise that resolves when the input is queued for ordered transmission.
Throws
If the command or PTY does not exist.Throws
If the input stream times out.Throws
If this handle is closed.Commands
Module for starting and interacting with commands in the sandbox.Constructors
Parameters
Returns
Commands
Methods
closeStdin()
stdin: true.
Parameters
Returns
Promise<void>
connect()
Parameters
Returns
Promise<CommandHandle>
CommandHandle handle to interact with the running command.
kill()
SIGKILL signal to kill the command.
Parameters
Returns
Promise<boolean>
true if the command was killed, false if the command was not found.
list()
Parameters
Returns
Promise<ProcessInfo[]>
list of running commands and PTY sessions.
run()
Call Signature
Parameters
Returns
Promise<CommandResult>
CommandResult result of the command execution.
Call Signature
Parameters
Returns
Promise<CommandHandle>
CommandHandle handle to interact with the running command.
Call Signature
Parameters
Returns
Promise<CommandResult | CommandHandle>
Either a CommandHandle or a CommandResult (depending on opts.background).
sendStdin()
Parameters
Returns
Promise<void>
streamInput()
send calls.
Use this instead of Commands.sendStdin when ordering matters; each
sendStdin call is a separate request. The stream sends keepalive messages
while idle.
In browsers, this requires fetch request-body streaming support (Chromium
over HTTP/2).
Parameters
Returns
CommandInputHandle
A handle whose send() method queues input in order and whose close() method ends the stream and waits for envd.
Throws
If the command does not exist, surfaced fromsend() or close().
Throws
If the stream timeout expires, surfaced fromsend() or close().
Example
Pty
Module for interacting with PTYs (pseudo-terminals) in the sandbox.Constructors
Parameters
Returns
Pty
Methods
connect()
Parameters
Returns
Promise<CommandHandle>
handle to interact with the PTY.
create()
Parameters
Returns
Promise<CommandHandle>
handle to interact with the PTY.
kill()
SIGKILL signal to kill the PTY.
Parameters
Returns
Promise<boolean>
true if the PTY was killed, false if the PTY was not found.
resize()
Parameters
Returns
Promise<void>
sendInput()
Parameters
Returns
Promise<void>
streamInput()
send calls.
Use this instead of Pty.sendInput when ordering matters; each
sendInput call is a separate request. The stream sends keepalive messages
while idle.
In browsers, this requires fetch request-body streaming support (Chromium
over HTTP/2).
Parameters
Returns
CommandInputHandle
A handle whose send() method queues input in order and whose close() method ends the stream and waits for envd.
Throws
If the PTY does not exist, surfaced fromsend() or close().
Throws
If the stream timeout expires, surfaced fromsend() or close().
Example
Interfaces
CommandRequestOpts
Options for sending a command request.Extended by
CommandStartOpts
Properties
requestTimeoutMs?
Default
signal?
AbortSignal that can be used to cancel the in-flight request.
When the signal is aborted, the underlying fetch is aborted and the
returned promise rejects with an AbortError.
CommandStartOpts
Options for starting a new command.Properties
background?
cwd?
Default
envs?
Sandbox constructor.
Default
{}
onStderr()?
Parameters
Returns
void | Promise<void>
onStdout()?
Parameters
Returns
void | Promise<void>
requestTimeoutMs?
Default
signal?
AbortSignal that can be used to cancel the in-flight request.
When the signal is aborted, the underlying fetch is aborted and the
returned promise rejects with an AbortError.
stdin?
Default
timeoutMs?
Default
user?
Default
default Sandbox user (as specified in the template)
CommandStreamInputOpts
Options for streaming input to a command or PTY.Properties
signal?
timeoutMs?
0 disables the timeout.