diff options
| author | Paul Eggert | 2017-05-19 00:11:48 -0700 |
|---|---|---|
| committer | Paul Eggert | 2017-05-19 00:13:27 -0700 |
| commit | 7c951fd51832badb09055a8e177f8ec358cbbdcf (patch) | |
| tree | 1b77d643aa5d2719ee7e070a82f499292d60adb3 /src/callproc.c | |
| parent | df9bec3b39b12b33db8f5a97d86797f6636e5e7d (diff) | |
| download | emacs-7c951fd51832badb09055a8e177f8ec358cbbdcf.tar.gz emacs-7c951fd51832badb09055a8e177f8ec358cbbdcf.zip | |
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) | |||
| 202 | message1 ("Waiting for process to die...(type C-g again to kill it instantly)"); | 202 | message1 ("Waiting for process to die...(type C-g again to kill it instantly)"); |
| 203 | 203 | ||
| 204 | /* This will quit on C-g. */ | 204 | /* This will quit on C-g. */ |
| 205 | wait_for_termination (synch_process_pid, 0, 1); | 205 | bool wait_ok = wait_for_termination (synch_process_pid, NULL, true); |
| 206 | |||
| 207 | synch_process_pid = 0; | 206 | synch_process_pid = 0; |
| 208 | message1 ("Waiting for process to die...done"); | 207 | message1 (wait_ok |
| 208 | ? "Waiting for process to die...done" | ||
| 209 | : "Waiting for process to die...internal error"); | ||
| 209 | } | 210 | } |
| 210 | #endif /* !MSDOS */ | 211 | #endif /* !MSDOS */ |
| 211 | } | 212 | } |
| @@ -866,9 +867,10 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int filefd, | |||
| 866 | make_number (total_read)); | 867 | make_number (total_read)); |
| 867 | } | 868 | } |
| 868 | 869 | ||
| 870 | bool wait_ok = true; | ||
| 869 | #ifndef MSDOS | 871 | #ifndef MSDOS |
| 870 | /* Wait for it to terminate, unless it already has. */ | 872 | /* Wait for it to terminate, unless it already has. */ |
| 871 | wait_for_termination (pid, &status, fd0 < 0); | 873 | wait_ok = wait_for_termination (pid, &status, fd0 < 0); |
| 872 | #endif | 874 | #endif |
| 873 | 875 | ||
| 874 | /* Don't kill any children that the subprocess may have left behind | 876 | /* 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, | |||
| 878 | SAFE_FREE (); | 880 | SAFE_FREE (); |
| 879 | unbind_to (count, Qnil); | 881 | unbind_to (count, Qnil); |
| 880 | 882 | ||
| 883 | if (!wait_ok) | ||
| 884 | return build_unibyte_string ("internal error"); | ||
| 885 | |||
| 881 | if (WIFSIGNALED (status)) | 886 | if (WIFSIGNALED (status)) |
| 882 | { | 887 | { |
| 883 | const char *signame; | 888 | const char *signame; |