diff options
Diffstat (limited to 'test/src/process-tests.el')
| -rw-r--r-- | test/src/process-tests.el | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/src/process-tests.el b/test/src/process-tests.el index a3fba8d328b..e62bcb3f7c0 100644 --- a/test/src/process-tests.el +++ b/test/src/process-tests.el | |||
| @@ -879,5 +879,33 @@ Return nil if FILENAME doesn't exist." | |||
| 879 | (file-regular-p filename) | 879 | (file-regular-p filename) |
| 880 | filename))) | 880 | filename))) |
| 881 | 881 | ||
| 882 | ;; Bug#46284 | ||
| 883 | (ert-deftest process-sentinel-interrupt-event () | ||
| 884 | "Test that interrupting a process on Windows sends \"interrupt\" to sentinel." | ||
| 885 | (skip-unless (eq system-type 'windows-nt)) | ||
| 886 | (with-temp-buffer | ||
| 887 | (let* ((proc-buf (current-buffer)) | ||
| 888 | ;; Start a new emacs process to wait idly until interrupted. | ||
| 889 | (cmd "emacs -batch --eval=\"(sit-for 50000)\"") | ||
| 890 | (proc (start-file-process-shell-command | ||
| 891 | "test/process-sentinel-signal-event" proc-buf cmd)) | ||
| 892 | (events '())) | ||
| 893 | |||
| 894 | ;; Capture any incoming events. | ||
| 895 | (set-process-sentinel proc | ||
| 896 | (lambda (_prc event) | ||
| 897 | (push event events))) | ||
| 898 | ;; Wait for the process to start. | ||
| 899 | (sleep-for 2) | ||
| 900 | (should (equal 'run (process-status proc))) | ||
| 901 | ;; Interrupt the sub-process and wait for it to die. | ||
| 902 | (interrupt-process proc) | ||
| 903 | (sleep-for 2) | ||
| 904 | ;; Should have received SIGINT... | ||
| 905 | (should (equal 'signal (process-status proc))) | ||
| 906 | (should (equal 2 (process-exit-status proc))) | ||
| 907 | ;; ...and the change description should be "interrupt". | ||
| 908 | (should (equal '("interrupt\n") events))))) | ||
| 909 | |||
| 882 | (provide 'process-tests) | 910 | (provide 'process-tests) |
| 883 | ;;; process-tests.el ends here | 911 | ;;; process-tests.el ends here |