aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJim Porter2024-07-09 10:45:35 -0700
committerJim Porter2024-07-11 16:39:35 -0700
commit0de0056fd6b3b70dde54884db5d9ffc013c49efc (patch)
tree0763897ad6af5c2f90ec066be7e1dc4c4730a02a /test
parentec1e300a215504bb9905a31145924d7f3d2cb9ab (diff)
downloademacs-0de0056fd6b3b70dde54884db5d9ffc013c49efc.tar.gz
emacs-0de0056fd6b3b70dde54884db5d9ffc013c49efc.zip
Don't emit a prompt in Eshell when a background command is killed
* lisp/eshell/esh-cmd.el (eshell-resume-command): Check for background-ness before resetting the prompt. * test/lisp/eshell/esh-cmd-tests.el (esh-cmd-test/background/simple-command): Make the regexp a bit stricter. (esh-cmd-test/background/kill): New test.
Diffstat (limited to 'test')
-rw-r--r--test/lisp/eshell/esh-cmd-tests.el14
1 files changed, 13 insertions, 1 deletions
diff --git a/test/lisp/eshell/esh-cmd-tests.el b/test/lisp/eshell/esh-cmd-tests.el
index 70e1901c169..d8124a19af6 100644
--- a/test/lisp/eshell/esh-cmd-tests.el
+++ b/test/lisp/eshell/esh-cmd-tests.el
@@ -113,7 +113,7 @@ bug#59469."
113 (with-temp-eshell 113 (with-temp-eshell
114 (eshell-match-command-output 114 (eshell-match-command-output
115 (format "*echo hi > #<%s> &" bufname) 115 (format "*echo hi > #<%s> &" bufname)
116 (rx "[echo" (? ".exe") "] " (+ digit) "\n")) 116 (rx bos "[echo" (? ".exe") "] " (+ digit) "\n"))
117 (eshell-wait-for-subprocess t)) 117 (eshell-wait-for-subprocess t))
118 (should (equal (buffer-string) "hi\n")))) 118 (should (equal (buffer-string) "hi\n"))))
119 119
@@ -129,6 +129,18 @@ bug#59469."
129 (eshell-wait-for-subprocess t)) 129 (eshell-wait-for-subprocess t))
130 (should (equal (buffer-string) "olleh\n")))) 130 (should (equal (buffer-string) "olleh\n"))))
131 131
132(ert-deftest esh-cmd-test/background/kill ()
133 "Make sure that a background command that gets killed doesn't emit a prompt."
134 (skip-unless (executable-find "sleep"))
135 (let ((background-message (rx bos "[sleep" (? ".exe") "] " (+ digit) "\n")))
136 (with-temp-eshell
137 (eshell-match-command-output "*sleep 10 &" background-message)
138 (kill-process (caar eshell-process-list))
139 (eshell-wait-for-subprocess t)
140 ;; Ensure we didn't emit another prompt after killing the
141 ;; background process.
142 (should (eshell-match-output background-message)))))
143
132 144
133;; Lisp forms 145;; Lisp forms
134 146