Module type Pvem_lwt_unix.SYSTEM

module type SYSTEM = sig .. end


Basic system access functions.
val sleep : float ->
(unit, [> `System of [> `Sleep of float ] * [> `Exn of exn ] ])
Pvem_lwt_unix.Deferred_result.t
Block for a given amount of seconds (Lwt_unix.sleep).
module Shell: sig .. end
Manipulate /bin/sh commands (flavors of Unix.system).
val with_timeout : float ->
f:(unit ->
('a,
[> `System of [> `With_timeout of float ] * [> `Exn of exn ]
| `Timeout of float ]
as 'error)
Pvem_lwt_unix.Deferred_result.t) ->
('a, 'error) Pvem_lwt_unix.Deferred_result.t
Execute a function f with a timeout (in seconds). If f throws an exception it will be passed as `System (_, e), if the functions timeouts the error will be `Timeout time.
val make_new_directory : ?perm:int ->
string ->
(unit,
[> `System of
[> `Make_directory of string ] *
[> `Already_exists | `Exn of exn | `Wrong_access_rights of int ] ])
Pvem_lwt_unix.Deferred_result.t
Create a new empty directory or fail if it already exists (i.e. like mkdir). The default permissions are 0o700.
val ensure_directory_path : ?perm:int ->
string ->
(unit,
[> `System of
[> `Make_directory of string ] *
[> `Exn of exn | `Wrong_access_rights of int ] ])
Pvem_lwt_unix.Deferred_result.t
Create as many directories as needed (can be 0) to ensure that the directory path exists (like mkdir -p). The default permissions are 0o700.
type file_info = [ `Absent
| `Block_device
| `Character_device
| `Directory
| `Fifo
| `Regular_file of int
| `Socket
| `Symlink of string ]
Quick information on files.
val file_info_to_string : file_info -> string
Convert file information to a string
val file_info : ?follow_symlink:bool ->
string ->
(file_info,
[> `System of [> `File_info of string ] * [> `Exn of exn ] ])
Pvem_lwt_unix.Deferred_result.t
Get information about a path (whether it exists, its size, or sym-link destination). If follow_symlink is false (default) use lstat (so the result can be `Symlink _), if true call stat (information about the target).
val list_directory : string ->
[ `Stream of
unit ->
(string option,
[> `System of [> `List_directory of string ] * [> `Exn of exn ] ])
Pvem_lwt_unix.Deferred_result.t ]
Get all the children of a directory, through a next stream-like function.
val remove : string ->
(unit,
[> `System of
[> `File_info of string | `List_directory of string | `Remove of string ] *
[> `Exn of exn ] ])
Pvem_lwt_unix.Deferred_result.t
Remove a file or a directory recursively. remove does not fail if the file does not exist.
val make_symlink : target:string ->
link_path:string ->
(unit,
[> `System of
[> `Make_symlink of string * string ] *
[> `Exn of exn | `File_exists of string ] ])
Pvem_lwt_unix.Deferred_result.t
Make a symbolic link link_path pointing at target. make_symlink fails if the file link_path already exists.
type file_destination = [ `Into of string | `Onto of string ] 
Specification of a “destination” for copy and move.
val copy : ?ignore_strange:bool ->
?symlinks:[ `Fail | `Follow | `Redo ] ->
?buffer_size:int ->
?if_exists:[ `Fail | `Overwrite | `Update ] ->
src:string ->
file_destination ->
(unit,
[> `System of
[> `Copy of string
| `File_info of string
| `List_directory of string
| `Make_directory of string
| `Make_symlink of string * string
| `Remove of string ] *
[> `Already_exists
| `Exn of exn
| `File_exists of string
| `File_not_found of string
| `IO of [> `File_exists of string | `Wrong_path of string ]
| `Not_a_directory of string
| `Wrong_access_rights of int
| `Wrong_file_kind of
string *
[> `Block_device
| `Character_device
| `Fifo
| `Socket
| `Symlink of string ]
| `Wrong_path of string ] ])
Pvem_lwt_unix.Deferred_result.t
Copy files or directories (recursively).

If ignore_strange is true copy won't fail on block/character devices, fifos or sockets (defaults to false).

The buffer_size (default 64_000) is used both for reading and writing files.

On can `Fail on symbolic links, `Follow them, or `Redo a new symlink with the same target.

val move_in_same_device : ?if_exists:[ `Fail | `Overwrite | `Update ] ->
src:string ->
file_destination ->
([ `Moved | `Must_copy ],
[> `System of
[> `File_info of string | `Move of string ] *
[> `Exn of exn | `File_exists of string ] ])
Pvem_lwt_unix.Deferred_result.t
Try to move src to dest using Lwt_unix.rename, if it works, return `Moved if it does not work but copy could work (i.e. both paths are not in the same device) return `Must_copy.
val move : ?ignore_strange:bool ->
?symlinks:[ `Fail | `Follow | `Redo ] ->
?buffer_size:int ->
?if_exists:[ `Fail | `Overwrite | `Update ] ->
src:string ->
file_destination ->
(unit,
[> `System of
[> `Copy of string
| `File_info of string
| `List_directory of string
| `Make_directory of string
| `Make_symlink of string * string
| `Move of string
| `Remove of string ] *
[> `Already_exists
| `Exn of exn
| `File_exists of string
| `File_not_found of string
| `IO of [> `File_exists of string | `Wrong_path of string ]
| `Not_a_directory of string
| `Wrong_access_rights of int
| `Wrong_file_kind of
string *
[> `Block_device
| `Character_device
| `Fifo
| `Socket
| `Symlink of string ]
| `Wrong_path of string ] ])
Pvem_lwt_unix.Deferred_result.t
Heavy-weight function trying to mimic the behavior the UNIX command “mv” (c.f. mv.c): it tries move_in_same_device and if it returns `Must_copy it calls copy and remove (if copy fails, the remove won't happen but there will be no clean-up of the files already copied).
type file_tree = [ `Leaf of string * file_info
| `Node of string * file_tree list ]
Representation of a hierarchy of files (`Leaf) and directories (`Node).
val file_tree : ?follow_symlinks:bool ->
string ->
(file_tree,
[> `System of
[> `File_info of string
| `File_tree of string
| `List_directory of string ] *
[> `Exn of exn | `File_not_found of string ] ])
Pvem_lwt_unix.Deferred_result.t
Obtain the file_tree starting at a given path.
val error_to_string : [< `Shell of
string *
[< `Exited of int | `Exn of exn | `Signaled of int | `Stopped of int ]
| `System of
[< `Copy of string
| `File_info of string
| `File_tree of string
| `List_directory of string
| `Make_directory of string
| `Make_symlink of string * string
| `Move of string
| `Remove of string ] *
[< `Already_exists
| `Exn of exn
| `File_exists of string
| `File_not_found of string
| `IO of
[< `Exn of exn
| `File_exists of string
| `Read_file_exn of string * exn
| `Write_file_exn of string * exn
| `Wrong_path of string ]
| `Not_a_directory of string
| `Wrong_access_rights of int
| `Wrong_file_kind of string * file_info
| `Wrong_path of string ] ] ->
string
Make a human-readable string for any error in this module.