f
armExitGuard(): ExitGuard
describe: () => string,
target?: ExitTarget,
write?: (message: string) => void
Makes exiting 0 something a command has to say, rather than what happens when nothing is left to do.
I
ExitGuard
What armExitGuard hands back: the one way to say the work produced a result.
-
reported(code: number): void
The result is in — exit with this code, and stop treating an exit as unexplained.
I
ExitTarget
The parts of process the guard touches, so a test can drive its exit without exiting.
-
exitCode: number | string | null | undefined
The code the process will exit with; assigning it is how the guard has its say.
-
on(): unknownevent: "exit",listener: () => void
Registers the
exitlistener — the last moment anything can still be said or decided.
Usage
import * as mod from "lib/utils/exit-guard.ts";