Library
Module
Module type
Parameter
Class
Class type
Operations on subprocesses
val pp_process_status :
Ppx_deriving_runtime.Format.formatter ->
process_status ->
Ppx_deriving_runtime.unit
val show_process_status : process_status -> Ppx_deriving_runtime.string
The type of execution results of subprocesses.
val pp :
Ppx_deriving_runtime.Format.formatter ->
t ->
Ppx_deriving_runtime.unit
val show : t -> Ppx_deriving_runtime.string
exception Execution_failure of t
val system :
?check:bool ->
?capture_stdout:bool ->
?capture_stderr:capture_stderr_type ->
?interval:float ->
string ->
string list ->
t
system prog args
is a rich version of Unix.system
and Sys.command
in the standard library of OCaml.
Example:
system "ocaml" ["ocaml"; "-vnum"]
pwd ()
returns a path to the current directory.
This is an alias of Unix.getcwd
.
val ls :
?check:bool ->
?capture_stdout:bool ->
?capture_stderr:capture_stderr_type ->
?interval:float ->
?args:string list ->
string list ->
t
ls ?check ?capture_stdout ?capture_stderr ?interval ?args paths
shows a list of files in paths
.
val rm :
?check:bool ->
?capture_stdout:bool ->
?capture_stderr:capture_stderr_type ->
?interval:float ->
?args:string list ->
string list ->
t
rm ?check ?capture_stdout ?capture_stderr ?interval ?args paths
removes files in paths
.
val cp :
?check:bool ->
?capture_stdout:bool ->
?capture_stderr:capture_stderr_type ->
?interval:float ->
?args:string list ->
string ->
string ->
t
cp ?check ?capture_stdout ?capture_stderr ?interval ?args src_path dest_path
copys a file or a directory from src_path
into dest_path
.
val mv :
?check:bool ->
?capture_stdout:bool ->
?capture_stderr:capture_stderr_type ->
?interval:float ->
?args:string list ->
string ->
string ->
t
mv ?check ?capture_stdout ?capture_stderr ?interval ?args src_path dest_path
moves a file or a directory from src_path
into dest_path
.
val sh :
?check:bool ->
?capture_stdout:bool ->
?capture_stderr:capture_stderr_type ->
?interval:float ->
?args:string list ->
string ->
t
sh ?check ?capture_stdout ?capture_stderr ?interval ?args script
evaluates a given code script
by sh
command.
Example:
sh {|
set -eu
VAR=hello
echo "$VAR"|}
val zsh :
?check:bool ->
?capture_stdout:bool ->
?capture_stderr:capture_stderr_type ->
?interval:float ->
?args:string list ->
string ->
t
zsh ?check ?capture_stdout ?capture_stderr ?interval ?args script
evaluates a given code script
by zsh
command.
val bash :
?check:bool ->
?capture_stdout:bool ->
?capture_stderr:capture_stderr_type ->
?interval:float ->
?args:string list ->
string ->
t
bash ?check ?capture_stdout ?capture_stderr ?interval ?args script
evaluates a given code script
by bash
command.
val python2 :
?check:bool ->
?capture_stdout:bool ->
?capture_stderr:capture_stderr_type ->
?interval:float ->
?args:string list ->
string ->
t
python2 ?check ?capture_stdout ?capture_stderr ?interval ?args script
evaluates a given code script
by python2
command.
val python3 :
?check:bool ->
?capture_stdout:bool ->
?capture_stderr:capture_stderr_type ->
?interval:float ->
?args:string list ->
string ->
t
python3 ?check ?capture_stdout ?capture_stderr ?interval ?args script
evaluates a given code script
by python3
command.
val ruby :
?check:bool ->
?capture_stdout:bool ->
?capture_stderr:capture_stderr_type ->
?interval:float ->
?args:string list ->
string ->
t
ruby ?check ?capture_stdout ?capture_stderr ?interval ?args script
evaluates a given code script
by ruby
command.
val perl :
?check:bool ->
?capture_stdout:bool ->
?capture_stderr:capture_stderr_type ->
?interval:float ->
?args:string list ->
string ->
t
perl ?check ?capture_stdout ?capture_stderr ?interval ?args script
evaluates a given code script
by perl
command.
val capture_in_process :
?check:bool ->
?capture_stdout:bool ->
?capture_stderr:capture_stderr_type ->
?interval:float ->
(unit -> 'a) ->
t
capture_in_process ?check ?capture_stdout ?capture_stderr ?interval f
captures data output to stdout/stderr during execution of a function f
.
NOTE: capture_in_process
creates a new subprocess and evaluates f
in the subprocess. Therefore f
cannot modify memory of the parent process. For example, the following snippet results in 0
, not 42
.
let r = ref 0 in
let _ = capture_in_process (fun () -> r := 42) in
!r (* 0, not 42 *)