]> git.eshelyaron.com Git - emacs.git/commitdiff
Allow using /dev/stdin as a --script parameter again
authorLars Ingebrigtsen <larsi@gnus.org>
Fri, 12 Nov 2021 03:21:56 +0000 (04:21 +0100)
committerLars Ingebrigtsen <larsi@gnus.org>
Fri, 12 Nov 2021 03:27:16 +0000 (04:27 +0100)
* lisp/startup.el (command-line-1): Fix breakage with
(file-truename "/dev/stdin") => "/proc/227795/fd/pipe:[1381505]"
when using /dev/stdin as a --script parameter.

lisp/startup.el

index 505d7b83f48668a88684a93797da044c99340b6a..a911aed1cd282c03236f02c2cc6d9023a402f0e2 100644 (file)
@@ -2526,7 +2526,15 @@ nil default-directory" name)
                      (let* ((file (command-line-normalize-file-name
                                    (or argval (pop command-line-args-left))))
                             ;; Take file from default dir.
-                            (file-ex (file-truename (expand-file-name file))))
+                            (file-ex (expand-file-name file))
+                            (truename (file-truename file-ex)))
+                       ;; We want to use the truename here if we can,
+                       ;; because that makes `eval-after-load' work
+                       ;; more reliably.  But If the file is, for
+                       ;; instance, /dev/stdin, the truename doesn't
+                       ;; actually exist on some systems.
+                       (when (file-exists-p truename)
+                         (setq file-ex truename))
                        (load file-ex nil t t)))
 
                     ((equal argi "-insert")