onStdout et onStderr à commands.run() en JavaScript, ou les fonctions de rappel on_stdout et on_stderr en Python.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
onStdout et onStderr à commands.run() en JavaScript, ou les fonctions de rappel on_stdout et on_stderr en Python.
import { Sandbox } from 'novita-sandbox/code-interpreter'
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)
await sandbox.kill()
from novita_sandbox.code_interpreter 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)
sandbox.kill()