aboutsummaryrefslogtreecommitdiffstats
path: root/src/callproc.c
diff options
context:
space:
mode:
authorNoam Postavsky2019-04-08 17:57:22 -0400
committerNoam Postavsky2019-04-14 22:43:38 -0400
commit9800df69cb7003bda1f2b98d6f11e89ba95afb9b (patch)
tree8de5b8b10e6a0743b7f227bef6bf87ffdb98ed4a /src/callproc.c
parentfc0f469fb5b5eb28ca4d9948190be6cb1bd8156e (diff)
downloademacs-9800df69cb7003bda1f2b98d6f11e89ba95afb9b.tar.gz
emacs-9800df69cb7003bda1f2b98d6f11e89ba95afb9b.zip
Let debugger handle process spawn errors on w32 (Bug#33016)
Since child_setup() is called between block_input()...unblock_input(), when an error is signaled the Lisp debugger is prevented from starting. Therefore, let the callers signal the error instead (which they already do for non-w32 platforms, just the error message needs an update). * src/callproc.c (child_setup) [WINDOWSNT]: Don't call report_file_error here. (call_process) [WINDOWNT]: * src/process.c (create_process) [WINDOWSNT]: Call report_file_errno here instead, after the unblock_input() call, same as for !WINDOWSNT. * src/lisp.h (CHILD_SETUP_ERROR_DESC): New preprocessor define. Flip the containing ifndef DOS_NT branches so that it's ifdef DOS_NT. * src/eval.c (when_entered_debugger): Remove. (syms_of_eval) <internal-when-entered-debugger>: Define it as a Lisp integer variable instead. (maybe_call_debugger): Update comment. * test/src/process-tests.el (make-process-w32-debug-spawn-error): * test/src/callproc-tests.el (call-process-w32-debug-spawn-error): New tests.
Diffstat (limited to 'src/callproc.c')
-rw-r--r--src/callproc.c7
1 files changed, 2 insertions, 5 deletions
diff --git a/src/callproc.c b/src/callproc.c
index a3d09609d7b..2cdf84d9a80 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -681,7 +681,7 @@ call_process (ptrdiff_t nargs, Lisp_Object *args, int filefd,
681 unblock_input (); 681 unblock_input ();
682 682
683 if (pid < 0) 683 if (pid < 0)
684 report_file_errno ("Doing vfork", Qnil, child_errno); 684 report_file_errno (CHILD_SETUP_ERROR_DESC, Qnil, child_errno);
685 685
686 /* Close our file descriptors, except for callproc_fd[CALLPROC_PIPEREAD] 686 /* Close our file descriptors, except for callproc_fd[CALLPROC_PIPEREAD]
687 since we will use that to read input from. */ 687 since we will use that to read input from. */
@@ -1174,7 +1174,7 @@ exec_failed (char const *name, int err)
1174 executable directory by the parent. 1174 executable directory by the parent.
1175 1175
1176 On GNUish hosts, either exec or return an error number. 1176 On GNUish hosts, either exec or return an error number.
1177 On MS-Windows, either return a pid or signal an error. 1177 On MS-Windows, either return a pid or return -1 and set errno.
1178 On MS-DOS, either return an exit status or signal an error. */ 1178 On MS-DOS, either return an exit status or signal an error. */
1179 1179
1180CHILD_SETUP_TYPE 1180CHILD_SETUP_TYPE
@@ -1319,9 +1319,6 @@ child_setup (int in, int out, int err, char **new_argv, bool set_pgrp,
1319 /* Spawn the child. (See w32proc.c:sys_spawnve). */ 1319 /* Spawn the child. (See w32proc.c:sys_spawnve). */
1320 cpid = spawnve (_P_NOWAIT, new_argv[0], new_argv, env); 1320 cpid = spawnve (_P_NOWAIT, new_argv[0], new_argv, env);
1321 reset_standard_handles (in, out, err, handles); 1321 reset_standard_handles (in, out, err, handles);
1322 if (cpid == -1)
1323 /* An error occurred while trying to spawn the process. */
1324 report_file_error ("Spawning child process", Qnil);
1325 return cpid; 1322 return cpid;
1326 1323
1327#else /* not WINDOWSNT */ 1324#else /* not WINDOWSNT */