diff --git a/src/w32fns.c b/src/w32fns.c index 457599fce0e1935eb22702710740eeec4164e562..bf3c1d5d3032620a35b54364beb53a63f123d734 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -10708,6 +10708,11 @@ default value t means to add the width of one canonical character of the tip frame. */); Vw32_tooltip_extra_pixels = Qt; + DEFVAR_BOOL ("w32-disable-abort-dialog", + w32_disable_abort_dialog, + doc: /* Non-nil means don't display the abort dialog when aborting. */); + w32_disable_abort_dialog = 0; + #if 0 /* TODO: Port to W32 */ defsubr (&Sx_change_window_property); defsubr (&Sx_delete_window_property); @@ -10902,6 +10907,9 @@ w32_backtrace (void **buffer, int limit) void emacs_abort (void) { + if (w32_disable_abort_dialog) + abort (); + int button; button = MessageBox (NULL, "A fatal error has occurred!\n\n" diff --git a/test/src/emacs-module-tests.el b/test/src/emacs-module-tests.el index 2aa85f0b247afc160e41c884e9a210433ebf7a6d..6a7ba5580da3163c8df778613c6bfc93039da1dc 100644 --- a/test/src/emacs-module-tests.el +++ b/test/src/emacs-module-tests.el @@ -208,14 +208,22 @@ must evaluate to a regular expression string." (with-temp-buffer (let* ((default-directory tempdir) (status (call-process mod-test-emacs nil t nil - "-batch" "-Q" "-module-assertions" "-eval" + "-batch" "-Q" "-module-assertions" + "-eval" "(setq w32-disable-abort-dialog t)" + "-eval" ,(prin1-to-string `(progn (require 'mod-test ,mod-test-file) ,@body))))) - (should (stringp status)) - ;; eg "Aborted" or "Abort trap: 6" - (should (string-prefix-p "Abort" status)) + ;; Aborting doesn't raise a signal on MS-DOS/Windows, but + ;; rather exits with a non-zero status: 2 on MS-DOS (see + ;; msdos.c:msdos_abort), 3 on Windows, per MSDN documentation + ;; of 'abort'. + (if (memq system-type '(ms-dos windows-nt)) + (should (>= status 2)) + (should (stringp status)) + ;; eg "Aborted" or "Abort trap: 6" + (should (string-prefix-p "Abort" status))) (search-backward "Emacs module assertion: ") (goto-char (match-end 0)) (should (string-match-p ,pattern