diff --git a/lib_eio_linux/eio_linux.ml b/lib_eio_linux/eio_linux.ml index 45c6f6dac..e868f75c8 100644 --- a/lib_eio_linux/eio_linux.ml +++ b/lib_eio_linux/eio_linux.ml @@ -1208,9 +1208,11 @@ let process = object let process = pid_to_process close pid in let cleanup () = try - ignore (wait_for_process [] pid); + process#stop; close () - with Unix.Unix_error (ECHILD, _, _) -> () + with Unix.Unix_error (Unix.ESRCH, _, _) -> + (* Process is already finished when trying to stop it. *) + () in Switch.on_release sw cleanup; process