1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
//! `haz` workspace task runner: library surface for the `haz`
//! binary.
//!
//! Exposes the runtime modules wired together by the `haz`
//! command-line tool (`src/main.rs`). Integration tests under
//! `tests/` drive these modules directly against fixture
//! workspaces; the binary itself is a thin adapter over
//! [`dispatch`].
use Path;
use Cmd;
use Result;
/// Exit code reserved for workspace-load failures, target-
/// resolution failures, and other internal / configuration errors
/// per `EXEC-021`'s fourth class. Distinct from
/// `haz_exec::exit_code`'s task-failure code (`1`) and the POSIX
/// signal codes (`130` / `143`).
pub const EXIT_INTERNAL_OR_CONFIG_ERROR: i32 = 2;
/// 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.
///
/// # Errors
///
/// Returns a [`miette::Report`] on workspace-load, target-
/// resolution, or scheduler failure. The binary maps any report
/// to [`EXIT_INTERNAL_OR_CONFIG_ERROR`].