pub fn run(args: impl IntoIterator<Item = OsString>) -> u8Expand description
Runs the CLI with args (the first item is the program name, as in std::env::args_os) and returns the exit
code. The npm addon calls this; the skif binary calls run_to_exit, which differs only in what happens to
memory and in entering the bazel run directory; everything else is shared, so their behaviour cannot drift.
It never changes the process’s current directory, even under bazel run: in a host such as Node.js, which caches
its own current directory, a change made here would leave the host out of step. A host that runs skif under
bazel run enters that directory itself first, as the npm package’s skif bin does (ADR 0011).
A panic in skif that reaches this call is caught and exits 2, as in the binary; the panic hook prints the message
and its location to stderr, and with --format json or toon stdout also receives the error document (kind
internal) naming both. A panic that skif catches itself on the way, such as one inside the type checker that falls back to
the untyped analysis (ADR 0010), does not end the run.
To learn the location, the first call chains a hook in front of the process’s panic hook (std::panic::set_hook),
once per process; it records the panic for the thread that raised it and then calls the hook it replaced, so the
host’s own handling still runs. A host that sets its own hook after that call drops the recording hook: a panic
still exits 2, but the error document then names only the panic’s payload, without the location.