diff options
| author | Jim Porter | 2024-05-25 13:46:24 -0700 |
|---|---|---|
| committer | Jim Porter | 2024-05-25 13:46:24 -0700 |
| commit | 57dc1ed665d72bc58befa4853fa479b770fe4fcc (patch) | |
| tree | 8940f319ceab957830ef5092a6dc888a729f50b0 /lisp | |
| parent | 91509d5d2a2dc818830cff63f13d6efcb229dc0c (diff) | |
| download | emacs-57dc1ed665d72bc58befa4853fa479b770fe4fcc.tar.gz emacs-57dc1ed665d72bc58befa4853fa479b770fe4fcc.zip | |
Fix a race condition when evaluating Eshell commands
* lisp/eshell/esh-cmd.el (eshell-do-eval): Don't defer when all the
processes are done.
* test/lisp/eshell/esh-cmd-tests.el
(esh-cmd-test/pipeline-wait/nested-pipes): New test.
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/eshell/esh-cmd.el | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el index dae1a77552f..57aeff59266 100644 --- a/lisp/eshell/esh-cmd.el +++ b/lisp/eshell/esh-cmd.el | |||
| @@ -1287,13 +1287,15 @@ have been replaced by constants." | |||
| 1287 | (setcdr form (cdr new-form))) | 1287 | (setcdr form (cdr new-form))) |
| 1288 | (eshell-do-eval form synchronous-p)) | 1288 | (eshell-do-eval form synchronous-p)) |
| 1289 | (if-let (((memq (car form) eshell-deferrable-commands)) | 1289 | (if-let (((memq (car form) eshell-deferrable-commands)) |
| 1290 | (procs (eshell-make-process-list result))) | 1290 | (procs (eshell-make-process-list result)) |
| 1291 | (active (seq-some #'eshell-process-active-p procs))) | ||
| 1291 | (if synchronous-p | 1292 | (if synchronous-p |
| 1292 | (apply #'eshell/wait procs) | 1293 | (apply #'eshell/wait procs) |
| 1293 | (eshell-manipulate form "inserting ignore form" | 1294 | (eshell-manipulate form "inserting ignore form" |
| 1294 | (setcar form 'ignore) | 1295 | (setcar form 'ignore) |
| 1295 | (setcdr form nil)) | 1296 | (setcdr form nil)) |
| 1296 | (throw 'eshell-defer procs)) | 1297 | (when active |
| 1298 | (throw 'eshell-defer procs))) | ||
| 1297 | (list 'quote result)))))))))))) | 1299 | (list 'quote result)))))))))))) |
| 1298 | 1300 | ||
| 1299 | ;; command invocation | 1301 | ;; command invocation |