Execute a command in the sandbox.
Commands are run using sh -c to execute the command string. Uses sh instead of bash for compatibility with minimal images like Alpine.
execute(command: string): Promise<ExecuteResponse>| Name | Type | Description |
|---|---|---|
command* | string | The shell command to execute |
const result = await sandbox.execute("echo 'Hello World'");
console.log(result.output); // "Hello World\n"
console.log(result.exitCode); // 0