--- src/gufoEngine.ml.orig 2020-03-29 00:19:15.000000000 +0800 +++ src/gufoEngine.ml 2025-10-18 13:38:44.000000000 +0800 @@ -26,6 +26,10 @@ open Array open Printf +(* Retry waitpid on EINTR. Some libraries (terminal, signals) can interrupt waitpid. *) +let rec waitpid_no_intr flags pid = + try Unix.waitpid flags pid + with Unix.Unix_error (Unix.EINTR, "waitpid", _) -> waitpid_no_intr flags pid let print_debug_arg2valMap arg2valMap = debug_print "DUMPING arg2ValMap"; @@ -940,7 +944,7 @@ in match to_fork with | true -> (0, MOSimpleCmd cmd) - | false -> let (_, processstatus) = Unix.waitpid [] pid in + | false -> let (_, processstatus) = waitpid_no_intr [] pid in let res = match processstatus with | Unix.WEXITED i -> i | Unix.WSIGNALED i -> i @@ -1036,7 +1040,7 @@ match to_fork with | true -> (0, MOSimpleCmd cmd) | false -> - let (_, processstatus) = Unix.waitpid [] pid in + let (_, processstatus) = waitpid_no_intr [] pid in let res = match processstatus with | Unix.WEXITED i -> i | Unix.WSIGNALED i -> i @@ -1095,7 +1099,7 @@ with _ -> () done; Stream.iter (fun achar -> output_char stdout_channel_out achar) stdout_stream; - let (_, processstatus) = Unix.waitpid [] pid in + let (_, processstatus) = waitpid_no_intr [] pid in let res = match processstatus with | Unix.WEXITED i -> i | Unix.WSIGNALED i -> i