Leap0

Process

Execute commands inside a sandbox.

Process endpoints let you execute one-shot commands inside a running sandbox.

Execute a command

Run a shell command and wait for the result. The command runs inside /bin/sh -c.

from leap0 import Leap0Client

client = Leap0Client()
sandbox = client.sandboxes.create()
result = sandbox.process.execute(
    command="echo Hello from Leap0",
    cwd="/home/user",
    timeout=30,
)

print(result.exit_code)
print(result.stdout)
print(result.stderr)
import { Leap0Client } from "leap0"

const client = new Leap0Client()
const sandbox = await client.sandboxes.create()

const result = await sandbox.process.execute({
  command: "echo Hello from Leap0",
  cwd: "/home/user",
  timeout: 30,
})

console.log(result.exitCode) // 0
console.log(result.stdout)   // Hello from Leap0
console.log(result.stderr)   // ""
await client.close()

Was this page helpful?

On this page