package b0
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha512=00a6868b4dfa34565d0141b335622a81a0e8d5b9e3c6dfad025dabfa3df2db2a1302b492953bbbce30c3a4406c324fcec25250a00b38f6d18a69e15605e3b07e
doc/b0.std/B0_std/Os/Exit/index.html
Module Os.ExitSource
Program exit.
Specifying exits
The type for specifying program exits. Either an exit code or a function (should be) calling B0_std.Cmd.execv.
exec ?env ?cwd file argv is an Exec _. That has a call to Os.Cmd.execv with the corresponding arguments.
get_code e is the exit code of e. Raises Invalid_argument if e is Exec.
Exiting exits
exit e exits according to e:
- If
eisCode c,Stdlib.exitcis called and the function never returns. - If
eisExec execv,execvis called. This can only return with anError _. In that case log it and call the function again with an error code - this guarantees termination.
Signal exit hooks
on_sigint ~hook f calls f () and returns its value. If SIGINT is signalled during that time hook is called followed by exit 130 – that is the exit code a SIGINT would produce.
on_sigint replaces an existing signal handler for Sys.sigint during time of the function call. It is restored when the function returns.
Note. Since Stdlib.exit is called Stdlib.at_exit functions are called if a SIGINT occurs during the call to f. This is not the case on an unhandled SIGINT.