When redirecting in Eshell, check for "/dev/null" specifically

This is so that users can type "cmd ... > /dev/null" in Eshell no
matter what their system's null device is called.  (Users can still
use their system's null device name when redirecting, too.  Eshell
doesn't need to do anything special to support that.)  This partially
reverts 67a8bdb90c.  See bug#59545.

Do not merge to master.

* lisp/eshell/esh-io.el (eshell-set-output-handle): Use "/dev/null"
literally.
This commit is contained in:
Jim Porter 2022-12-20 16:20:50 -08:00
parent e59216d3be
commit d6c8d5dbc9

View file

@ -342,7 +342,11 @@ If HANDLES is nil, use `eshell-current-handles'."
(when target
(let ((handles (or handles eshell-current-handles)))
(if (and (stringp target)
(string= target (null-device)))
;; The literal string "/dev/null" is intentional here.
;; It just provides compatibility so that users can
;; redirect to "/dev/null" no matter the actual value
;; of `null-device'.
(string= target "/dev/null"))
(aset handles index nil)
(let ((where (eshell-get-target target mode))
(current (car (aref handles index))))