From 3664f2bdfb64ae7d68b6be12e4ed6b027bdc2951 Mon Sep 17 00:00:00 2001 From: Jim Porter Date: Tue, 20 Dec 2022 16:20:50 -0800 Subject: [PATCH] When redirecting to the null device in Eshell, allow "/dev/null" This is so that users can type "cmd ... > /dev/null" in Eshell no matter what their system's null device is called. This fixes a regression from 67a8bdb90c9b5865b7f17290c7135b1a5458c36d. Do not merge to master. * lisp/eshell/esh-io.el (eshell-set-output-handle): Handle both 'null-device' and the literal "/dev/null". --- lisp/eshell/esh-io.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/eshell/esh-io.el b/lisp/eshell/esh-io.el index 4620565f857..b428f068472 100644 --- a/lisp/eshell/esh-io.el +++ b/lisp/eshell/esh-io.el @@ -342,7 +342,10 @@ eshell-set-output-handle (when target (let ((handles (or handles eshell-current-handles))) (if (and (stringp target) - (string= target (null-device))) + ;; Always treat "/dev/null" as the null device for + ;; compatibility, even if the system calls it something + ;; else. + (member target (list "/dev/null" (null-device)))) (aset handles index nil) (let ((where (eshell-get-target target mode)) (current (car (aref handles index)))) -- 2.25.1