all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#6079: 24.0.50; set-process-sentinel doesn't work inside sentinels
@ 2010-05-02 12:07 Helmut Eller
  2019-08-21 23:58 ` Lars Ingebrigtsen
  0 siblings, 1 reply; 3+ messages in thread
From: Helmut Eller @ 2010-05-02 12:07 UTC (permalink / raw)
  To: 6079

set-process-sentinel can't be used inside sentinels because
exec_sentinel_unwind always restores the old value.  This code 

(let* ((proc (start-process "foo" nil "/bin/bash" "-c" "sleep 100"))
       (a-called nil)
       (sentinel-a (lambda (proc msg)
                     (message "a: %s" msg)
                     (setq a-called t)))
       (b-called nil)
       (sentinel-b (lambda (proc msg)
                     (message "b: %s" msg)
                     (set-process-sentinel proc sentinel-a)
                     (setq b-called t))))
  (set-process-sentinel proc sentinel-b)
  (signal-process proc 'SIGSTOP)
  (message "waiting for b")
  (while (not b-called)
    (accept-process-output proc))
  (signal-process proc 'SIGKILL)
  (message "waiting for a")
  (while (not a-called)
    (accept-process-output proc)))

prints:

  waiting for b
  b: stopped (signal)
  waiting for a
  b: killed

which means that sentinel-b was called twice.  Since sentinel-b sets the
the process sentinel to sentinel-a I would expect that sentinel-b can
only be called once.







^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2019-10-14  5:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-02 12:07 bug#6079: 24.0.50; set-process-sentinel doesn't work inside sentinels Helmut Eller
2019-08-21 23:58 ` Lars Ingebrigtsen
2019-10-14  5:58   ` Lars Ingebrigtsen

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.