Skip to content
Spinbox is experimental: APIs change and data may be lost. Status lists what is built and what proves it.

spin exec

View Markdown
Run a command inside a workspace and stream its output.
The command runs over the same brokered connection as 'spin ssh', so it needs no direct
network access to the workspace. Its standard input, output and error are connected to
yours, and its exit status becomes this command's exit status.
A terminal is allocated when both ends are one - so an interactive program works and a
pipeline does not get control characters in its data. Force either with --tty/--no-tty.
--detach starts the command under systemd in the workspace and prints its run id: it goes on
after this command ends, and its output and error, merged, are kept on the workspace's disk.
--attach <id> prints that output from the start and follows it until the run ends, with its
exit status. 'systemctl stop spin-exec-<id>' in the workspace stops it.
Examples:
spin exec my-workspace -- ls -la
spin exec my-workspace -- npm run build
spin exec my-workspace --tty -- bash
spin exec my-workspace -w /srv/app -- git status
spin exec my-workspace -- cat build.log > local.log
spin exec my-workspace --detach -w /srv/app -- make release
spin exec my-workspace --attach 3f9a0c1d2e4b
Usage:
spin exec <workspace> -- <command> [args...] [flags]
Flags:
--attach string Print a detached run's output until it ends, and exit with its status
-d, --detach[=true|false] Start the command, print its run id and leave it running
-h, --help[=true|false] help for exec
-i, --identity string Identity file (private key)
--no-tty[=true|false] Do not allocate a terminal
--start[=true|false] Start the workspace first if it is stopped
--timeout duration How long to wait for the workspace to be running; by default, until the control plane gives up on it
-t, --tty[=true|false] Allocate a terminal even if this one is not
-u, --user string User to run the command as (default "root")
-w, --workdir string Directory to run the command in
Global Flags:
--config string config file (default is $HOME/.spin/config.yaml)
-o, --output string text for a person, or json: one document of what the API answered, and no prose (default "text")
--profile string named profile to use; SPIN_PROFILE names it when this flag does not (default "default")
--traceparent string the W3C traceparent of the span this command is part of; its own span is sent to the installation unless the profile says telemetry: false

Generated by task reference from spin/cmd/cli at 51f7e0dea.

Installations run Spinbox v20261027.01; the reference is generated from spin v20261114.01 (51f7e0dea). This page as Markdown, for a model or a terminal.