Commit 9f89e098 authored by John Wiegley's avatar John Wiegley
Browse files

(eshell/cat): Do a quick test if something is a regular file, before

checking if it is a directory or symlink. This avoids a call to
eshell-file-attributes, which can be expensive in some situations.
parent ef94bd99
......@@ -572,9 +572,12 @@ symlink, then revert to the system's definition of cat."
(if (or eshell-in-pipeline-p
(catch 'special
(eshell-for arg args
(unless (let ((attrs (eshell-file-attributes arg)))
(and attrs (memq (aref (nth 8 attrs) 0)
'(?d ?l ?-))))
(unless (or (and (stringp arg)
(> (length arg) 0)
(eq (aref arg 0) ?-))
(let ((attrs (eshell-file-attributes arg)))
(and attrs (memq (aref (nth 8 attrs) 0)
'(?d ?l ?-)))))
(throw 'special t)))))
(let ((ext-cat (eshell-search-path "cat")))
(if ext-cat
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment