kosa8 cloud sandbox exec
Run a command in a cloud sandbox, or start one in the background
Usage#
kosa8 cloud sandbox exec ID -- COMMAND [ARG...]
Runs the command to completion, printing what it writes as it runs, and exits with the command's exit code. A sleeping sandbox wakes for it. Output streams, so a command is not cut off at the 90 s a buffered API exec is held to (on a host that cannot stream, it is: use --background for longer ones there). --json prints {exit, stdout, stderr} once it ends.
--background (-d) starts it and returns at once with its ID (bg_…); it keeps running after this call, its output going to a file in the sandbox. Check on it, or wait for it, with kosa8 cloud sandbox exec-status.
--timeout stops the command in the sandbox when it runs that long (exit 124), the way to bound a test run or build you do not trust to finish.
-e NAME=value sets a variable for this command; -e NAME takes NAME's value from this shell and --env-file reads KEY=value lines, so secrets stay off argv.
Options#
| Flag | Type | What it does | Default |
|---|---|---|---|
-d, --background | bool | start it and return at once with its ID (bg_…) | — |
-e, --env | stringArray | set an environment variable, NAME=value, or NAME for this shell's value (repeatable) | [] |
--env-file | stringArray | read NAME=value lines from this file (- for stdin; repeatable) | [] |
--image | string | image to run the command in (default: the template's own) | — |
--timeout | duration | stop the command after this long (exit 124); unset, wait up to an hour | 1h0m0s |
Example#
kosa8 cloud sandbox exec sbx_abc -- python3 -c 'print(1+1)' kosa8 cloud sandbox exec sbx_abc -e DEBUG=1 -e GITHUB_TOKEN -- ./run.sh kosa8 cloud sandbox exec -d sbx_abc -- python3 -m http.server 3000 kosa8 cloud sandbox exec-status sbx_abc bg_0123456789abcdef --wait