onStdout, onStderr callbacks to the commands.run() method in JavaScript
or the on_stdout, on_stderr callbacks to the commands.run() method in Python.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
onStdout, onStderr callbacks to the commands.run() method in JavaScript
or the on_stdout, on_stderr callbacks to the commands.run() method in Python.
import { Sandbox } from 'e2b'
const sandbox = await Sandbox.create()
const result = await sandbox.commands.run('echo hello; sleep 1; echo world', {
onStdout: (data) => {
console.log(data)
},
onStderr: (data) => {
console.log(data)
},
})
console.log(result)
from e2b import Sandbox
sandbox = Sandbox.create()
result = sandbox.commands.run('echo hello; sleep 1; echo world', on_stdout=lambda data: print(data), on_stderr=lambda data: print(data))
print(result)
Was this page helpful?