Imandrakit_io
Utils for IO
module Popen : sig ... end
Run sub-processes.
module Xdg : sig ... end
Basic XDG config
Purely syntactic computation of absolute path.
val make_absolute : ?in_dir:string -> string -> resolved_file
Turn a file path into an absolute path, using Unix.realpath
val find_file :
?in_dir:string ->
file_name:string ->
load_path:string list ->
unit ->
resolved_file option
Find a file.
We look in this order:
in_dir
or current directory if not provided,Finally, we return a resolved_file.
Protection against signals when calling the given function
val read_i32_framed : in_channel -> string
read_i32_framed ic
reads a int32_le-framed message from ic
val write_i32_framed : out_channel -> string -> unit
write_i32_framed oc s
writes s
as a int32_le-framed message onto oc
val with_capture_stdio_file :
file:string ->
?redirect_stdout:bool ->
?redirect_stderr:bool ->
append:bool ->
unit ->
(unit -> 'a) ->
'a
with_capture_stdio_file ~file ~append f
runs f()
in a context where stdout/stderr are redirected to file
. This captures a lock because stdout/stderr are global resources.
val with_capture_stdio_string :
?on_stdout:(bytes -> int -> int -> unit) ->
?on_stderr:(bytes -> int -> int -> unit) ->
unit ->
(unit -> 'a) ->
('a, exn) result * string * string
with_capture_stdio_string () f
computes f()
but captures stdout/stderr into strings. This captures a lock because stdout/stderr are global resources.
val dup_stdin_stdout :
?on_stdin:(bytes -> int -> int -> int) ->
?on_stdout:(bytes -> int -> int -> unit) ->
unit ->
in_channel * out_channel
dup_stdin_stdout ()
returns cin, cout
where cout
is a copy of the old stdout, and cin
is a copy of the old stdin
, and stdin
and stdout
are redirected into the void (unless callbacks are provided).