Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: executing processes #8409

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 3 additions & 16 deletions src/dune_engine/scheduler.ml
Original file line number Diff line number Diff line change
Expand Up @@ -892,23 +892,10 @@ let with_job_slot f =
f t.cancel t.config)
;;

(* We use this version privately in this module whenever we can pass the
scheduler explicitly *)
let wait_for_process t pid =
let+ res, outcome =
Fiber.Cancel.with_handler
t.cancel
~on_cancel:(fun () ->
Process_watcher.killall t.process_watcher Sys.sigkill;
Fiber.return ())
(fun () ->
let ivar = Fiber.Ivar.create () in
Process_watcher.register_job t.process_watcher { pid; ivar };
Fiber.Ivar.read ivar)
in
match outcome with
| Cancelled () -> cancelled ()
| Not_cancelled -> res
let ivar = Fiber.Ivar.create () in
Process_watcher.register_job t.process_watcher { pid; ivar };
Fiber.Ivar.read ivar
;;

type termination_reason =
Expand Down
1 change: 1 addition & 0 deletions test/expect-tests/dune_rpc_e2e/dune_rpc_jobs.ml
Original file line number Diff line number Diff line change
Expand Up @@ -80,5 +80,6 @@ let%expect_test "rpc jobs after rebuild" =
Background process is running, let's interrupt it...
Start 1 _build/default/foo
Background process is running, let's interrupt it...
Stop 1
Start 2 _build/default/foo |}]
;;
Loading