From 7c951fd51832badb09055a8e177f8ec358cbbdcf Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Fri, 19 May 2017 00:11:48 -0700 Subject: Attempt to work around macOS vfork bug Problem reported by YAMAMOTO Mitsuharu in: http://lists.gnu.org/archive/html/emacs-devel/2017-05/msg00342.html This is related to the fix for Bug#26397. * src/callproc.c (call_process_cleanup, call_process) [!MSDOS]: Report internal error if wait_for_termination fails. * src/sysdep.c (get_child_status): Return -1 if waitpid is buggy, instead of aborting. (wait_for_termination): Return bool success value. All callers changed. --- src/callproc.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'src/callproc.c') diff --git a/src/callproc.c b/src/callproc.c index e967e45d03f..7c85eed835f 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -202,10 +202,11 @@ call_process_cleanup (Lisp_Object buffer) message1 ("Waiting for process to die...(type C-g again to kill it instantly)"); /* This will quit on C-g. */ - wait_for_termination (synch_process_pid, 0, 1); - + bool wait_ok = wait_for_termination (synch_process_pid, NULL, true); synch_process_pid = 0; - message1 ("Waiting for process to die...done"); + message1 (wait_ok + ? "Waiting for process to die...done" + : "Waiting for process to die...internal error"); } #endif /* !MSDOS */ } @@ -866,9 +867,10 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int filefd, make_number (total_read)); } + bool wait_ok = true; #ifndef MSDOS /* Wait for it to terminate, unless it already has. */ - wait_for_termination (pid, &status, fd0 < 0); + wait_ok = wait_for_termination (pid, &status, fd0 < 0); #endif /* Don't kill any children that the subprocess may have left behind @@ -878,6 +880,9 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int filefd, SAFE_FREE (); unbind_to (count, Qnil); + if (!wait_ok) + return build_unibyte_string ("internal error"); + if (WIFSIGNALED (status)) { const char *signame; -- cgit v1.2.1