Async handle to a running command with streaming output and auto-reconnect.
Async iterable, yielding OutputChunk objects (stdout and stderr interleaved in arrival order). Access .result after iteration to get the full ExecutionResult.
Auto-reconnect behavior:
class CommandHandleconst handle = await sandbox.run("make build", { timeout: 600, wait: false });
for await (const chunk of handle) { // auto-reconnects on transient errors
process.stdout.write(chunk.data);
}
const result = await handle.result;
console.log(`Exit code: ${result.exit_code}`);Read the 'started' message to populate commandId and pid.
Must be called (and awaited) before iterating for new executions.
Async iterate over output chunks with auto-reconnect on transient errors.
Reconnect strategy:
Send a kill signal to the running command (SIGKILL).
The server kills the entire process group. The stream will subsequently yield an exit message with a non-zero exit code.
Reconnect to this command from the last known offsets.
Returns a new CommandHandle that resumes output from where this one left off.
Write data to the command's stdin.