once exec

Execute a literal action through the cache

Synopsis#

plaintext
once exec [OPTIONS] [ARGV]

Description#

Low-level action surface for direct commands and script adapters. The cache key is the full argv, declared environment variables, optional working directory, and optional timeout. A second invocation with the same key reuses the captured stdout, stderr, and exit code. With --script, or when argv looks like <runtime> <script> [args...] and the file has once headers, Once applies script-aware parsing instead.

Arguments#

ArgumentRequiredDescription
<ARGV>noCommand and arguments. Use -- to separate from once flags

Options#

FlagValueDefaultDescription
--sandbox<SANDBOX>offLocal filesystem sandbox policy for the command action
--script(flag)falseInterpret argv as <runtime> <script> [args...] and apply once headers from the script file. Useful as the explicit form, for example once exec --script bash scripts/build.sh, and for directly executable scripts via a shebang such as #!/usr/bin/env -S once exec -- bash
-e<ENV>Pass an environment variable to the command. Repeatable
--cwd<CWD>Working directory, relative to the project root. Must not be absolute or escape the project
--timeout-ms<MS>Per-action timeout in milliseconds. The child is killed if it exceeds the deadline
--cache-failures(flag)falseCache non-zero exits the same way zero exits are cached. Off by default; transient failures shouldn't poison the cache
--verify-reproducible(flag)falseRun the action twice while bypassing the cache and report whether the two trials produced identical results, instead of executing normally. Exits non-zero when any divergence is found. Useful for catching nondeterministic tools and undeclared inputs that leak through the cache key
--remote(flag)falseRun the command on a compute provider
--network<NETWORK>unrestrictedWhether the command may reach the network. Defaults to unrestricted (the host network is available, matching existing behavior). deny isolates the command from the network on Linux so an undeclared fetch fails loudly instead of leaking into the cache key
--compute<PROVIDER>Compute provider used with --remote. Defaults to the configured execution provider
-C, --directory<DIR>Project root. Defaults to the current directory; the cache lives under <project>/.once/. Mirrors make -C
--format<FORMAT>humanOutput format for Once's structured data (cache stats, run/exec trailers). Defaults to a human-readable rendering; pass json or toon to get machine-parseable output for scripting and for agent consumers
-v, --verbose(flag)0Increase log verbosity. Repeat for more (-v: info, -vv: debug, -vvv: trace). Overridden by RUST_LOG
-q, --quiet(flag)falseSuppress human-mode success and progress trailers. Errors and the structured envelope of --format json/toon still print. Mirrors the -q flag of common build tools
--list(flag)falsePrint the command surface at the current command depth
--memory-limit<SIZE>Maximum memory scheduling budget for local actions. Defaults to two thirds of the memory visible to the host or container