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

* bug#6079: 24.0.50; set-process-sentinel doesn't work inside sentinels
  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
  0 siblings, 1 reply; 3+ messages in thread
From: Lars Ingebrigtsen @ 2019-08-21 23:58 UTC (permalink / raw)
  To: Helmut Eller; +Cc: 6079

Helmut Eller <eller.helmut@gmail.com> writes:

> 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.

(I'm going through old bug reports that have unfortunately gotten no
attention yet.)

I tried reproducing this bug in Emacs 27, but I get:

waiting for b
b: stopped (signal)

waiting for a
a: killed

The exec_sentinel_unwind function no longer exists in Emacs, so the code
in this area has changed in the nine years since you reported this bug.

Do you still see this bug in more modern Emacs versions?

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





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

* bug#6079: 24.0.50; set-process-sentinel doesn't work inside sentinels
  2019-08-21 23:58 ` Lars Ingebrigtsen
@ 2019-10-14  5:58   ` Lars Ingebrigtsen
  0 siblings, 0 replies; 3+ messages in thread
From: Lars Ingebrigtsen @ 2019-10-14  5:58 UTC (permalink / raw)
  To: Helmut Eller; +Cc: 6079

Lars Ingebrigtsen <larsi@gnus.org> writes:

> The exec_sentinel_unwind function no longer exists in Emacs, so the code
> in this area has changed in the nine years since you reported this bug.
>
> Do you still see this bug in more modern Emacs versions?

More information was requested some weeks back, but no response was
given, so I'm closing this bug report.

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





^ 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.