How can I have grep not print out 'No such file or directory' errors?

后端 未结 9 1001
情书的邮戳
情书的邮戳 2020-11-28 19:06

I\'m grepping through a large pile of code managed by git, and whenever I do a grep, I see piles and piles of messages of the form:

> grep pattern * -R -         


        
9条回答
  •  悲&欢浪女
    2020-11-28 19:33

    I was getting lots of these errors running "M-x rgrep" from Emacs on Windows with /Git/usr/bin in my PATH. Apparently in that case, M-x rgrep uses "NUL" (the Windows null device) rather than "/dev/null". I fixed the issue by adding this to .emacs:

    ;; Prevent issues with the Windows null device (NUL)
    ;; when using cygwin find with rgrep.
    (defadvice grep-compute-defaults (around grep-compute-defaults-advice-null-device)
      "Use cygwin's /dev/null as the null-device."
      (let ((null-device "/dev/null"))
        ad-do-it))
    (ad-activate 'grep-compute-defaults)
    

提交回复
热议问题