pub fn dispatch(cmd: &Cmd, cwd: &Path) -> Result<i32>Expand description
Dispatch a parsed Cmd against cwd and return the per-
command exit code.
cwd is a parameter rather than read from
std::env::current_dir so callers (the binary, integration
tests, embedders) drive the dispatch deterministically. The
binary’s main reads cwd from the environment once and passes
it here.
haz init is the one subcommand that does NOT load a workspace
(it creates one), so the Context::open preamble is skipped
for it and the cwd flows through directly. Every other
subcommand consumes the freshly-built Context by value.
§Errors
Returns a miette::Report on workspace-load, target-
resolution, or scheduler failure. The binary maps any report
to EXIT_INTERNAL_OR_CONFIG_ERROR.