Jupyter_notebook.ProcessOperations on subprocesses
val pp_process_status :
Ppx_deriving_runtime.Format.formatter ->
process_status ->
Ppx_deriving_runtime.unitval show_process_status : process_status -> Ppx_deriving_runtime.stringThe type of execution results of subprocesses.
val pp :
Ppx_deriving_runtime.Format.formatter ->
t ->
Ppx_deriving_runtime.unitval show : t -> Ppx_deriving_runtime.stringexception Execution_failure of tval system :
?check:bool ->
?capture_stdout:bool ->
?capture_stderr:capture_stderr_type ->
?interval:float ->
string ->
string list ->
tsystem 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 ->
tls ?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 ->
trm ?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 ->
tcp ?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 ->
tmv ?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 ->
tsh ?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 ->
tzsh ?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 ->
tbash ?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 ->
tpython2 ?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 ->
tpython3 ?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 ->
truby ?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 ->
tperl ?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) ->
tcapture_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 *)