@@ -49,8 +49,12 @@ val pid : #t -> int
49
49
val await : #t -> exit_status
50
50
(* * [await t] waits for process [t] to exit and then reports the status. *)
51
51
52
- val await_exn : #t -> unit
53
- (* * Like {! await} except an exception is raised if the status is not [`Exited 0]. *)
52
+ val await_exn : ?is_success :(int -> bool ) -> #t -> unit
53
+ (* * Like {! await} except an exception is raised if does not return a successful
54
+ exit status.
55
+
56
+ @param is_success Used to determine if an exit code is successful.
57
+ Default is [Int.equal 0]. *)
54
58
55
59
val signal : #t -> int -> unit
56
60
(* * [signal t i] sends the signal [i] to process [t].
@@ -113,12 +117,16 @@ val run :
113
117
?stdin :#Flow. source ->
114
118
?stdout :#Flow. sink ->
115
119
?stderr :#Flow. sink ->
120
+ ?is_success :(int -> bool ) ->
116
121
?env :string array ->
117
122
?executable :string ->
118
123
string list -> unit
119
124
(* * [run] does {!spawn} followed by {!await_exn}, with the advantage that if the process fails then
120
125
the error message includes the command that failed.
121
126
127
+ When [is_success] is provided, it is called with the exit code to determine whether it indicates success or failure.
128
+ Without [is_success], success requires the process to return an exit code of 0.
129
+
122
130
Note: If [spawn] needed to create extra fibers to copy [stdin], etc, then it also waits for those to finish. *)
123
131
124
132
val parse_out :
@@ -127,6 +135,7 @@ val parse_out :
127
135
?cwd :#Fs. dir Path. t ->
128
136
?stdin :#Flow. source ->
129
137
?stderr :#Flow. sink ->
138
+ ?is_success :(int -> bool ) ->
130
139
?env :string array ->
131
140
?executable :string ->
132
141
string list -> 'a
0 commit comments