[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 785a045b86: Ensure that the CAR of 'eshell-last-async-procs' alwa
From: |
Lars Ingebrigtsen |
Subject: |
master 785a045b86: Ensure that the CAR of 'eshell-last-async-procs' always points to a process |
Date: |
Sat, 5 Feb 2022 01:59:22 -0500 (EST) |
branch: master
commit 785a045b868e0aeef08858e86a9efe48311e8f48
Author: Jim Porter <jporterbugs@gmail.com>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
Ensure that the CAR of 'eshell-last-async-procs' always points to a process
Previously, if a non-process was piped to a process, this could end up
being nil, which isn't correct. 'eshell-last-async-procs' should just
ignore non-process commands in a pipeline.
* lisp/eshell/esh-cmd.el (eshell-do-pipelines): Set 'headproc'
correctly.
* test/lisp/eshell/eshell-tests.el (eshell-test/pipe-headproc): New test.
---
lisp/eshell/esh-cmd.el | 3 +--
test/lisp/eshell/eshell-tests.el | 7 +++++++
2 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el
index e702de03a0..5819506cc0 100644
--- a/lisp/eshell/esh-cmd.el
+++ b/lisp/eshell/esh-cmd.el
@@ -800,8 +800,7 @@ This macro calls itself recursively, with NOTFIRST non-nil."
((cdr pipeline) t)
(t (quote 'last)))))
(let ((proc ,(car pipeline)))
- ,(unless notfirst
- '(setq headproc proc))
+ (setq headproc (or proc headproc))
(setq tailproc (or tailproc proc))
proc))))))
diff --git a/test/lisp/eshell/eshell-tests.el b/test/lisp/eshell/eshell-tests.el
index c5ca0a5485..d6ee1bdb17 100644
--- a/test/lisp/eshell/eshell-tests.el
+++ b/test/lisp/eshell/eshell-tests.el
@@ -123,6 +123,13 @@ e.g. \"{(+ 1 2)} 3\" => 3"
(eshell-command-result-p "echo ${echo hi}-${*echo there}"
"hi-there\n")))
+(ert-deftest eshell-test/pipe-headproc ()
+ "Check that piping a non-process to a process command waits for the process"
+ (skip-unless (executable-find "cat"))
+ (with-temp-eshell
+ (eshell-command-result-p "echo hi | *cat"
+ "hi")))
+
(ert-deftest eshell-test/pipe-tailproc ()
"Check that piping a process to a non-process command waits for the process"
(skip-unless (executable-find "echo"))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 785a045b86: Ensure that the CAR of 'eshell-last-async-procs' always points to a process,
Lars Ingebrigtsen <=