diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2017-05-19 00:11:48 -0700 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2017-05-19 00:13:27 -0700 |
commit | 7c951fd51832badb09055a8e177f8ec358cbbdcf (patch) | |
tree | 1b77d643aa5d2719ee7e070a82f499292d60adb3 /src/callproc.c | |
parent | df9bec3b39b12b33db8f5a97d86797f6636e5e7d (diff) | |
download | emacs-7c951fd51832badb09055a8e177f8ec358cbbdcf.tar.gz |
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.
Diffstat (limited to 'src/callproc.c')
-rw-r--r-- | src/callproc.c | 13 |
1 files changed, 9 insertions, 4 deletions
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; |