Module B00.Tool
Command line tools.
A tool is specified either by name, to be looked up via an unspecified mecanism, or by a file path to an executable file. It also declares the environment variables it accesses in the process environment and whether and how it supports response files.
Declared environment variables are split into relevant and shielded variables. A relevant variable is a variable whose value influences the tool's output. A shielded variable is a variable whose value does not influence the tool's output but is nonetheless essential to its operation. Shielded environment variables do not appear in the spawn environment signature which is used to memoize tool spawns. Variables specifying the location of temporary file directories are good examples of shielded variables.
Portability. In order to maximize portability no .exe suffix should be added to executable names on Windows, the search procedure will add the suffix during the tool search procedure if absent.
Environment variables
val tmp_vars : env_varstmp_varsis["TMPDIR"; "TEMP"; "TMP"].
Response files
val response_file_of : (B0_std.Cmd.t -> string) -> (B0_std.Fpath.t -> B0_std.Cmd.t) -> response_fileresponse_file_of to_file cliis a response file specification that usesto_file cmdto convert the command linecmdto a response file content andcli fa command line fragment to be given to the tool so that it treats filefas a response file.
val args0 : response_fileargs0is response file support for tools that reads null byte (0x00) terminated arguments response files via an-args0 FILEcommand line synopsis.
Tools
val v : ?response_file:response_file -> ?shielded_vars:env_vars -> ?vars:env_vars -> B0_std.Cmd.tool -> tv ~response_file ~shielded_vars ~vars cmdis a tool specified bycmd.varsare the relevant variables accessed by the tool (defaults to[]).shielded_varsare the shielded variables accessed by the tool (defaults totmp_vars).response_filedefines the reponse file support for the tool (if any).
val by_name : ?response_file:response_file -> ?shielded_vars:env_vars -> ?vars:env_vars -> string -> tby_nameis likevbut reference the tool directly via a name.- raises Invalid_argument
if
Fpath.is_segnameisfalse.
val name : t -> B0_std.Cmd.toolname tist's tool name. If this is a relative file path with a single segment the tool is meant to be searched via an external mecanism.
val shielded_vars : t -> env_varsshieled_vars tare the shielded environment variables accessed byt.
val response_file : t -> response_file optionresponse_file tist's response file specification (if any).
val read_env : t -> B0_std.Os.Env.t -> B0_std.Os.Env.t * B0_std.Os.Env.tread_env t envis (all, relevant) withallthe environment with the variables ofenvthat are invars tandshielded_vars tandrelevantthose ofvars tonly.