package b0

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

Program exits.

Support for B00_std.Os.Exit exits which are more evolved than those provided by cmdliner.

Common exit codes

ok is the zero exit code.

val no_such_name : B00_std.Os.Exit.t

no_such_name (122) indicates a named entity was not found.

val some_error : B00_std.Os.Exit.t

some_error (123) indicates an indiscriminate error reported on stdout.

val infos : Cmdliner.Cmd.Exit.info list

infos has the infos of Cmdliner.Term.default_exits, no_such_name, some_error and those above.

Evaluating and exiting

of_eval_result ~term_error r is:

  • e if r is Ok (`Ok e)
  • ok if r is Ok _
  • Os.Exit.Code Cmdliner.Exit.cli_error if r is Error `Parse.
  • Os.Exit.Code Cmdliner.Exit.internal_error if r is Error `Exn.
  • Os.Exit.code term_error if r is Error `Term. term_error (defaults to Os.Exit.Code Cmdliner.Exit.cli_error).
val exit : exec_error:B00_std.Os.Exit.t -> B00_std.Os.Exit.t -> 'a

exit e exits with e. This uses B00_std.Os.Exit.exit and in case of Error _ logs it and exits with exec_error which if given an exit code is then guaranteed to exit.

OCaml

Innovation. Community. Security.