Skip to content
pols.so docs
Esc
↑↓navigate↵open⌘Jpreview
On this page

pols exec

Run a command in a sandbox, streaming its output

Run a command in a running sandbox as the sandbox user (uid 1000, passwordless sudo), or as root with --root. Output streams as it is produced and pols exits with the command’s exit code. With --json, pols prints one result containing stdout, stderr and the exit code after the command completes.

Usage

pols exec SANDBOX -- COMMAND [ARG...] [flags]

Examples

pols exec web -- uname -a
pols exec web -- bash -lc 'cd app && npm test'
echo 'print(1)' | pols exec web --stdin -- python3

Flags

    --cwd string             working directory (default: the user's home)
-e, --env stringArray        environment variable for this command: KEY copies it from your environment, KEY=VALUE sets it (repeatable)
    --env-file stringArray   read KEY=VALUE lines from a file (repeatable; --env wins)
-h, --help                   help for exec
    --root                   run as root
-i, --stdin                  send local stdin to the command (up to 768 KiB)
    --timeout int            kill the command after this many seconds (default 600)

The global flags work with this command too.