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

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

bug#50166: 28.0.50; ECM for possible process-status/sentinel bug


From: Lars Ingebrigtsen
Subject: bug#50166: 28.0.50; ECM for possible process-status/sentinel bug
Date: Mon, 23 Aug 2021 00:18:31 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)

Adam Porter <adam@alphapapa.net> writes:

> According to https://orgmode.org/worg/org-faq.html#ecm:
>
>     This is a French acronym used by some mailing list members; it stands
>     for "Exemple Complet Minimal", or "Complete Minimal   Example".

I see.  :-)

The example wasn't that minimal, though, so I shortened it a bit to
understand it better:

;;;  -*- lexical-binding: t; -*-

(defun start-curls ()
  (interactive)
  (dotimes (i 10)
    (let* ((process-buffer (generate-new-buffer (format "argh-curl-%02d" i)))
           (process (make-process :name "argh-"
                                  :buffer process-buffer
                                  :coding 'binary
                                  :command '("curl"
                                             "--silent"
                                             "--compressed"
                                             "--location"
                                             "--dump-header" "-"
                                             "--config" "-")
                                  :connection-type 'pipe
                                  :sentinel #'argh--sentinel
                                  :stderr process-buffer)))
      (process-send-string process "--url https://httpbin.org/get\n";)
      (process-send-eof process)
      process)))

(defun argh--sentinel (process status)
  (with-current-buffer (process-buffer process)
    (when (equal (string-clean-whitespace status) "finished")
      (message "status: %s %s %S" (string-clean-whitespace status)
               (process-status process) process)
      (kill-buffer (current-buffer)))))


And, indeed, after `M-x start-curls' I'm usually prompted for a

Buffer "argh-curl-09<2>" has a running process; kill it? (yes or no)

However, the status messaged by all those say:

status: finished exit #<process argh-<1>>

So somehow process-status can claim that the status is `exit', but
`kill-buffer' then says that the process is alive...  Most puzzling.

-- 
(domestic pets only, the antidote for overdose, milk.)
   bloggy blog: http://lars.ingebrigtsen.no





reply via email to

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