GNU bug report logs - #6079
24.0.50; set-process-sentinel doesn't work inside sentinels

Previous Next

Package: emacs;

Reported by: Helmut Eller <eller.helmut <at> gmail.com>

Date: Sun, 2 May 2010 12:09:01 UTC

Severity: normal

Tags: moreinfo

Found in version 24.0.50

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Helmut Eller <eller.helmut <at> gmail.com>
To: 6079 <at> debbugs.gnu.org
Subject: bug#6079: 24.0.50; set-process-sentinel doesn't work inside sentinels
Date: Sun, 02 May 2010 14:07:52 +0200
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.





This bug report was last modified 5 years and 219 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.