Skip to content

Hangs with no output when called from Emacs with make-process and pipe connection type #951

@alphapapa

Description

@alphapapa

What version of ripgrep are you using?

ripgrep 0.8.1 (rev c8e9f25)
-SIMD -AVX

How did you install ripgrep?

Debian package downloaded from link in readme.

What operating system are you using ripgrep on?

Ubuntu 14.04
Emacs 26.1

Describe your question, feature request, or bug.

rg does not seem to work properly with regard to pipes.

grep works:

(let ((default-directory "~/src/emacs/emacs"))
  (setq argh (make-process :name "grep"
                           :command (list "rgrep" "TODO")
                           :connection-type 'pipe
                           :buffer (get-buffer-create "*grep*"))))
(with-current-buffer (process-buffer argh)
  (length (buffer-string))) ;; => 114100
(process-status argh) ;; => exit

rg does not:

(let ((default-directory "~/src/emacs/emacs"))
  (setq argh (make-process :name "rg"
                           :command (list "rg" "TODO")
                           :connection-type 'pipe
                           :buffer (get-buffer-create "*rg*"))))
(with-current-buffer (process-buffer argh)
  (length (buffer-string))) ;; => 0
(process-status argh) ;; => run

The process is still running:

$ pgrep -a rg
31513 /usr/bin/rg TODO

However, if I use the pty type, it works:

(let ((default-directory "~/src/emacs/emacs"))
  (setq argh (make-process :name "rg"
                           :command (list "rg"
                                          "TODO")
                           :connection-type 'pty
                           :buffer (get-buffer-create "*rg*"))))
(with-current-buffer (process-buffer argh)
  (length (buffer-string))) ;; => 96824
(process-status argh) ;; => exit

ag also seems to work correctly, like grep.

Thanks for your help.

Metadata

Metadata

Assignees

No one assigned

    Labels

    docAn issue with or an improvement to documentation.questionAn issue that is lacking clarity on one or more points.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions