diff options
| author | Noam Postavsky | 2019-04-08 17:57:22 -0400 |
|---|---|---|
| committer | Noam Postavsky | 2019-04-14 22:43:38 -0400 |
| commit | 9800df69cb7003bda1f2b98d6f11e89ba95afb9b (patch) | |
| tree | 8de5b8b10e6a0743b7f227bef6bf87ffdb98ed4a /test/src/process-tests.el | |
| parent | fc0f469fb5b5eb28ca4d9948190be6cb1bd8156e (diff) | |
| download | emacs-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 'test/src/process-tests.el')
| -rw-r--r-- | test/src/process-tests.el | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/src/process-tests.el b/test/src/process-tests.el index 5dbf441e8c2..0bb7ebe50a8 100644 --- a/test/src/process-tests.el +++ b/test/src/process-tests.el | |||
| @@ -215,6 +215,26 @@ | |||
| 215 | (string-to-list "stdout\n") | 215 | (string-to-list "stdout\n") |
| 216 | (string-to-list "stderr\n")))))) | 216 | (string-to-list "stderr\n")))))) |
| 217 | 217 | ||
| 218 | (ert-deftest make-process-w32-debug-spawn-error () | ||
| 219 | "Check that debugger runs on `make-process' failure (Bug#33016)." | ||
| 220 | (skip-unless (eq system-type 'windows-nt)) | ||
| 221 | (let* ((debug-on-error t) | ||
| 222 | (have-called-debugger nil) | ||
| 223 | (debugger (lambda (&rest _) | ||
| 224 | (setq have-called-debugger t) | ||
| 225 | ;; Allow entering the debugger later in the same | ||
| 226 | ;; test run, before going back to the command | ||
| 227 | ;; loop. | ||
| 228 | (setq internal-when-entered-debugger -1)))) | ||
| 229 | (should (eq :got-error ;; NOTE: `should-error' would inhibit debugger. | ||
| 230 | (condition-case-unless-debug () | ||
| 231 | ;; Emacs doesn't search for absolute filenames, so | ||
| 232 | ;; the error will be hit in the w32 process spawn | ||
| 233 | ;; code. | ||
| 234 | (make-process :name "test" :command '("c:/No-Such-Command")) | ||
| 235 | (error :got-error)))) | ||
| 236 | (should have-called-debugger))) | ||
| 237 | |||
| 218 | (ert-deftest make-process/file-handler/found () | 238 | (ert-deftest make-process/file-handler/found () |
| 219 | "Check that the ‘:file-handler’ argument of ‘make-process’ | 239 | "Check that the ‘:file-handler’ argument of ‘make-process’ |
| 220 | works as expected if a file name handler is found." | 240 | works as expected if a file name handler is found." |