@@ -49,8 +49,12 @@ val pid : #t -> int
4949val await : #t -> exit_status
5050(* * [await t] waits for process [t] to exit and then reports the status. *)
5151
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]. *)
5458
5559val signal : #t -> int -> unit
5660(* * [signal t i] sends the signal [i] to process [t].
@@ -113,12 +117,16 @@ val run :
113117 ?stdin :#Flow. source ->
114118 ?stdout :#Flow. sink ->
115119 ?stderr :#Flow. sink ->
120+ ?is_success :(int -> bool ) ->
116121 ?env :string array ->
117122 ?executable :string ->
118123 string list -> unit
119124(* * [run] does {!spawn} followed by {!await_exn}, with the advantage that if the process fails then
120125 the error message includes the command that failed.
121126
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+
122130 Note: If [spawn] needed to create extra fibers to copy [stdin], etc, then it also waits for those to finish. *)
123131
124132val parse_out :
@@ -127,6 +135,7 @@ val parse_out :
127135 ?cwd :#Fs. dir Path. t ->
128136 ?stdin :#Flow. source ->
129137 ?stderr :#Flow. sink ->
138+ ?is_success :(int -> bool ) ->
130139 ?env :string array ->
131140 ?executable :string ->
132141 string list -> 'a
0 commit comments