bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#56002: update with an additional example


From: Tom Gillespie
Subject: bug#56002: update with an additional example
Date: Wed, 15 Jun 2022 19:28:21 -0700

I have been reading the docs on accepting output again,
and I see that there might be some subtlety here, but in
fact following the examples in the docs should reveal
another way the bug can express itself.

Specifically, in the original example I did not call
accept-process-output on the stderr process as is
suggested by the docs. Unfortunately, the docs are
misleading in this case because I am doing things
inside an unwind-protect cleanup clause and
accepting output from the stderr process causes
the example (below) to hang forever.

I think this happens because the stderr process is not
cleaned up correctly, OR possibly because of some
unexpected interaction due to the use of unwind-protect.

Example:
#+begin_src bash
read -r -d '' example <<'EOF'
(let ((stderr-buffer (generate-new-buffer " rc stderr")))
  (unwind-protect
      (let ((process
             (make-process
              :name "process that never actually starts"
              :stderr stderr-buffer
              :command '("i_fail_before_there_can_be_a_return_code"))))
        (message "this will never print because we never get here")
        (while (accept-process-output process)))
    (while (accept-process-output (get-buffer-process stderr-buffer)))
    (kill-buffer stderr-buffer)))
EOF
emacs -Q -batch -eval "${example}"
#+end_src

Docs in question:
https://www.gnu.org/software/emacs/manual/html_node/elisp/Accepting-Output.html





reply via email to

[Prev in Thread] Current Thread [Next in Thread]