Shells in OCaml
3
fork

Configure Feed

Select the types of activity you want to include in your feed.

Fix re-delegation of TC

+4 -6
+4 -6
src/lib/eunix.ml
··· 32 32 33 33 external getpgrp : unit -> int = "caml_merry_getpgrp" 34 34 external tcgetpgrp : Unix.file_descr -> int = "caml_merry_tcgetpgrp" 35 - external tcsetpgrp : int -> int -> int = "caml_merry_tcsetpgrp" 35 + external tcsetpgrp : Unix.file_descr -> int -> int = "caml_merry_tcsetpgrp" 36 36 37 37 let delegate_control ~pgid fn = 38 - let shell_pid = Unix.getpid () in 38 + let shell_pid = getpgrp () in 39 39 Fun.protect 40 - ~finally:(fun () -> 41 - let _ : int = tcsetpgrp 0 shell_pid in 42 - ()) 40 + ~finally:(fun () -> assert (Int.equal 0 @@ tcsetpgrp Unix.stdin shell_pid)) 43 41 (fun () -> 44 - match tcsetpgrp (Obj.magic Unix.stdin : int) pgid with 42 + match tcsetpgrp Unix.stdin pgid with 45 43 | 0 -> fn () 46 44 | n -> Fmt.failwith "tcsetpgrp: %i" n) 47 45