···2121 let add_error b t = { t with processes = Nlist.cons (`Error b) t.processes }
22222323 (* Section 2.9.2 https://pubs.opengroup.org/onlinepubs/9799919799/ *)
2424- let await_exit ~pipefail t =
2424+ let await_exit ~pipefail ~interactive t =
2525 let await = function
2626- | `Process p -> E.await p
2626+ | `Process p ->
2727+ if interactive then
2828+ Eunix.delegate_control ~pgid:t.id @@ fun () -> E.await p
2929+ else E.await p
2730 | `Built_in b -> b
2831 | `Error n -> Exit.nonzero () n
2932 in