Skip to content

Commit

Permalink
parallel: exit child with non-zero code on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
yasunariw committed Oct 20, 2024
1 parent 4a65100 commit dd681b2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions parallel.ml
Original file line number Diff line number Diff line change
Expand Up @@ -249,8 +249,13 @@ let run_forks_simple ?(revive=false) ?wait_stop f args =
let launch f x =
match Nix.fork () with
| `Child ->
let () = try f x with exn -> log #error ~exn ~backtrace:true "worker failed" in
exit 0
begin try
f x;
exit 0
with exn ->
log #error ~exn ~backtrace:true "worker failed";
exit 1
end
| `Forked pid -> Hashtbl.add workers pid x; pid
in
args |> List.iter (fun x -> let (_:int) = launch f x in ());
Expand Down

0 comments on commit dd681b2

Please sign in to comment.