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 0112).
A panic in skif is caught and exits 2, as the binary’s install_panic_hook makes it do; the panic hook prints
the message and its location to stderr, and with --format json stdout also receives the error document (kind
internal) naming both.
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.