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), as root with --root, or as a user added with pols users add with --user.
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. With --detach, the command keeps running
without pols: pols prints its process ID at once (see pols processes).
Usage
pols exec SANDBOX -- COMMAND [ARG...] [flags]
Examples
pols exec web -- uname -a
pols exec web -- bash -lc 'cd app && npm test'
pols exec web --user alice -- whoami
echo 'print(1)' | pols exec web --stdin -- python3
pols exec web --detach -- bash -lc 'npm run build'
Flags
--cwd string working directory (default: the user's home)
-d, --detach start the command as a detached process and print its ID
-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, none with --detach)
-u, --user pols users run as this sandbox user (see pols users; default: user)
The global flags work with this command too.