xx
.md

run

run executes a command from the project root. It registers the command as a root task and returns a dependency, so other tasks can explicitly wait for it or inherit environment changes from its dependencies.

Each task starts from a clean operating-system environment rather than the invoking shell's full environment. HOME points to xx-managed storage, XDG_* variables are excluded, and temporary variables point to a command-scoped directory removed after all tasks finish. Each task receives its own environment clone; dependencies apply from left to right.

Arguments

ArgumentRequiredDescription
commandYesNon-empty tuple of strings. First item is the executable; remaining items are arguments.
depsNoDependencies activated before the command, in list order. Defaults to [].

A bare executable name is resolved through the task's virtual PATH. A relative path containing / or \ is resolved from project root. Absolute executable paths are also accepted. Output is forwarded to xx.

Examples

Run a command

load("@os@1", "run")

run(("go", "version"))

A one-item tuple needs a trailing comma:

run(("tools/check",))

Configure its environment

load("@os@1", "env_set", "run")

run(
    ("go", "test", "./..."),
    deps=[env_set("CGO_ENABLED", "0")],
)

Order commands

load("@os@1", "run")

generate = run(("tools/generate",))
run(("tools/check",), deps=[generate])