diff options
| author | Jim Porter | 2024-06-25 21:39:35 -0700 |
|---|---|---|
| committer | Jim Porter | 2024-06-25 21:39:35 -0700 |
| commit | da4bc5c9274a6705501e24fb8f2984f5bf5fe099 (patch) | |
| tree | 902b42832d46840f665b2c0885db1d9d6ed3f7e9 /test | |
| parent | f8399633b4cc17b79ceee4ba3bd0f36fc3c0b3d9 (diff) | |
| download | emacs-da4bc5c9274a6705501e24fb8f2984f5bf5fe099.tar.gz emacs-da4bc5c9274a6705501e24fb8f2984f5bf5fe099.zip | |
Always perform Eshell process cleanup runs in the Eshell buffer
Previously, some code executed in a timer, which could execute in the
wrong buffer, leading to a hang.
* lisp/eshell/esh-proc.el (eshell-sentinel): Use 'with-current-buffer'
in the timer function.
* test/lisp/eshell/esh-proc-tests.el (eshell-test-value): New variable.
(esh-proc-test/sentinel/change-buffer): New test.
Diffstat (limited to 'test')
| -rw-r--r-- | test/lisp/eshell/esh-proc-tests.el | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/lisp/eshell/esh-proc-tests.el b/test/lisp/eshell/esh-proc-tests.el index 643cb8b125a..85b02845ab3 100644 --- a/test/lisp/eshell/esh-proc-tests.el +++ b/test/lisp/eshell/esh-proc-tests.el | |||
| @@ -45,6 +45,8 @@ | |||
| 45 | "'") | 45 | "'") |
| 46 | "A shell command that prints the standard streams connected as TTYs.") | 46 | "A shell command that prints the standard streams connected as TTYs.") |
| 47 | 47 | ||
| 48 | (defvar eshell-test-value nil) | ||
| 49 | |||
| 48 | ;;; Tests: | 50 | ;;; Tests: |
| 49 | 51 | ||
| 50 | 52 | ||
| @@ -130,6 +132,20 @@ | |||
| 130 | (should (= eshell-last-command-status 1)) | 132 | (should (= eshell-last-command-status 1)) |
| 131 | (should (eq eshell-last-command-result nil))))) | 133 | (should (eq eshell-last-command-result nil))))) |
| 132 | 134 | ||
| 135 | (ert-deftest esh-proc-test/sentinel/change-buffer () | ||
| 136 | "Check that changing the current buffer while running a command works. | ||
| 137 | See bug#71778." | ||
| 138 | (eshell-with-temp-buffer bufname "" | ||
| 139 | (with-temp-eshell | ||
| 140 | (let (eshell-test-value) | ||
| 141 | (eshell-insert-command | ||
| 142 | (concat (format "for i in 1 2 {sleep 1; echo hello} > #<%s>; " bufname) | ||
| 143 | "setq eshell-test-value t")) | ||
| 144 | (with-current-buffer bufname | ||
| 145 | (eshell-wait-for (lambda () eshell-test-value)) | ||
| 146 | (should (equal (buffer-string) "hellohello"))) | ||
| 147 | (eshell-match-command-output "echo goodbye" "\\`goodbye\n"))))) | ||
| 148 | |||
| 133 | 149 | ||
| 134 | ;; Pipelines | 150 | ;; Pipelines |
| 135 | 151 | ||