module Host_io:sig
..end
module Ssh:sig
..end
module Error:sig
..end
typet =
Ketrew_pure.Host.t
val default_timeout_upper_bound : float Pervasives.ref
typetimeout =
[ `At_most_seconds of float | `Host_default | `None | `Seconds of float ]
`Host_default
→ use the excution_timeout
value of the host. `None
→ force no timeout even if the host has a execution_timeout
.`Seconds f
→ use f
seconds as timeout.`At_most_seconds f
-> use f
seconds, unless the host has a smaller
execution_timeout
field.`At_most_seconds !default_timeout_upper_bound
.val execute : ?timeout:timeout ->
t ->
string list ->
(< exited : int; stderr : string; stdout : string >,
[> `Host of
[> `Execution of
< host : string; message : string; stderr : string option;
stdout : string option >
| `Ssh_failure of
[> `Wrong_log of string
| `Wrong_status of Unix_process.Exit_code.t ] *
string
| `System of [> `Sleep of float ] * [> `Exn of exn ]
| `Timeout of float
| `Unix_exec of string ]
Error.execution ])
Unix_io.Deferred_result.t
Unix.execv
even
on top of SSH.typeshell =
string -> string list
"sh"; "-c"; cmd
val shell_sh : sh:string -> shell
shell_sh "/bin/sh"
for a known path or command).val get_shell_command_output : ?timeout:timeout ->
?with_shell:shell ->
t ->
string ->
(string * string,
[> `Host of
[> `Execution of
< host : string; message : string; stderr : string option;
stdout : string option >
| `Non_zero of string * int
| `Ssh_failure of
[> `Wrong_log of string
| `Wrong_status of Unix_process.Exit_code.t ] *
string
| `System of [> `Sleep of float ] * [> `Exn of exn ]
| `Timeout of float
| `Unix_exec of string ]
Error.execution Error.non_zero_execution ])
Unix_io.Deferred_result.t
(stdout, stderr)
pair
(succeeds iff the exit status is 0
).val get_shell_command_return_value : ?timeout:timeout ->
?with_shell:shell ->
t ->
string ->
(int,
[> `Host of
[> `Execution of
< host : string; message : string; stderr : string option;
stdout : string option >
| `Ssh_failure of
[> `Wrong_log of string
| `Wrong_status of Unix_process.Exit_code.t ] *
string
| `System of [> `Sleep of float ] * [> `Exn of exn ]
| `Timeout of float
| `Unix_exec of string ]
Error.execution ])
Unix_io.Deferred_result.t
val run_shell_command : ?timeout:timeout ->
?with_shell:shell ->
t ->
string ->
(unit,
[> `Host of
[> `Execution of
< host : string; message : string; stderr : string option;
stdout : string option >
| `Non_zero of string * int
| `Ssh_failure of
[> `Wrong_log of string
| `Wrong_status of Unix_process.Exit_code.t ] *
string
| `System of [> `Sleep of float ] * [> `Exn of exn ]
| `Timeout of float
| `Unix_exec of string ]
Error.execution Error.non_zero_execution ])
Unix_io.Deferred_result.t
0
).val do_files_exist : ?timeout:timeout ->
?with_shell:shell ->
t ->
Ketrew_pure.Path.t list ->
(bool,
[> `Host of
[> `Execution of
< host : string; message : string; stderr : string option;
stdout : string option >
| `Ssh_failure of
[> `Wrong_log of string
| `Wrong_status of Unix_process.Exit_code.t ] *
string
| `System of [> `Sleep of float ] * [> `Exn of exn ]
| `Timeout of float
| `Unix_exec of string ]
Error.execution ])
Unix_io.Deferred_result.t
val get_fresh_playground : t -> Ketrew_pure.Path.t option
val ensure_directory : ?timeout:timeout ->
?with_shell:shell ->
t ->
path:Ketrew_pure.Path.t ->
(unit,
[> `Host of
[> `Execution of
< host : string; message : string; stderr : string option;
stdout : string option >
| `Non_zero of string * int
| `Ssh_failure of
[> `Wrong_log of string
| `Wrong_status of Unix_process.Exit_code.t ] *
string
| `System of [> `Sleep of float ] * [> `Exn of exn ]
| `Timeout of float
| `Unix_exec of string ]
Error.execution Error.non_zero_execution ])
Unix_io.Deferred_result.t
path
exists on the host.val put_file : ?timeout:timeout ->
t ->
path:Ketrew_pure.Path.t ->
content:string ->
(unit,
[> `Host of
[> `Execution of
< host : string; message : string; stderr : string option;
stdout : string option >
| `Ssh_failure of
[> `Wrong_log of string
| `Wrong_status of Unix_process.Exit_code.t ] *
string
| `System of [> `Sleep of float ] * [> `Exn of exn ]
| `Timeout of float
| `Unix_exec of string ]
Error.execution
| `IO of [> `Write_file_exn of Unix_io.IO.path * exn ] ])
Unix_io.Deferred_result.t
path
containing contents
.val get_file : ?timeout:timeout ->
t ->
path:Ketrew_pure.Path.t ->
(string,
[> `Cannot_read_file of string * string
| `Timeout of Ketrew_pure.Internal_pervasives.Time.t ])
Unix_io.Deferred_result.t
path
.val grab_file_or_log : ?timeout:timeout ->
t ->
Ketrew_pure.Path.t ->
(string, Ketrew_pure.Internal_pervasives.Log.t) Unix_io.Deferred_result.t
Ketrew.Host_io.get_file
, it fails with a Log.t
(for use in “long-running” plugins).