[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#141: Process sentinel not called in batch mode
From: |
Chong Yidong |
Subject: |
bug#141: Process sentinel not called in batch mode |
Date: |
Tue, 13 May 2008 19:28:04 -0400 |
Helmut Eller <eller.helmut@gmail.com> wrote:
> process-sentinels aren't called in batch mode. I'm not sure if this
> is a bug or the expected behavior, but I find this quite frustrating.
> To reproduce the problem do:
> $shell> cat test-sentinel.el
(defvar sentinel-called nil)
(defun main ()
(let ((proc (start-process "test" nil "bash" "-c" "sleep 1 ; exit 20")))
(set-process-sentinel proc (lambda (proc msg)
(message "sentinel: %S %s" proc msg)
(setq sentinel-called t)))
(while (not sentinel-called)
(message "status: %s exit-status: %s sentinel-called: %s"
(process-status proc) (process-exit-status proc)
sentinel-called)
(sit-for 1)
(accept-process-output proc 1))))
(main)
> $shell> emacs -Q -batch -l test-sentinel.el
This problem occurs because wait_reading_process_output only calls
status_notify when given a nonzero DO_DISPLAY argument (process.c:4451).
Although wait_reading_process_output is called from many places in
Emacs, it is given a nonzero DO_DISPLAY argument only during
kbd_buffer_get_event. But that function is never called in batch mode.
Maybe something like the attached patch should be applied.
Alternatively, we could change Faccept_process_output so that when Emacs
is in batch mode, it calls wait_reading_process_output with a nonzero
DO_DISPLAY argument. Opinions?
*** trunk/src/process.c.~1.539.~ 2008-04-09 13:46:04.000000000 -0400
--- trunk/src/process.c 2008-05-13 19:27:01.000000000 -0400
***************
*** 4414,4420 ****
available, notify the user of the change right away. After
this explicit check, we'll let the SIGCHLD handler zap
timeout to get our attention. */
! if (update_tick != process_tick && do_display)
{
SELECT_TYPE Atemp;
#ifdef NON_BLOCKING_CONNECT
--- 4414,4421 ----
available, notify the user of the change right away. After
this explicit check, we'll let the SIGCHLD handler zap
timeout to get our attention. */
! if (update_tick != process_tick
! && (do_display || noninteractive))
{
SELECT_TYPE Atemp;
#ifdef NON_BLOCKING_CONNECT
- bug#141: Process sentinel not called in batch mode,
Chong Yidong <=
- bug#141: Process sentinel not called in batch mode, Stefan Monnier, 2008/05/14
- bug#141: Process sentinel not called in batch mode, Richard M Stallman, 2008/05/16
- bug#141: Process sentinel not called in batch mode, Stefan Monnier, 2008/05/16
- bug#141: Process sentinel not called in batch mode, Eli Zaretskii, 2008/05/16
- bug#141: Process sentinel not called in batch mode, Stefan Monnier, 2008/05/16
- bug#141: Process sentinel not called in batch mode, Chong Yidong, 2008/05/16
- bug#141: Process sentinel not called in batch mode, Eli Zaretskii, 2008/05/16
- bug#141: Process sentinel not called in batch mode, Stefan Monnier, 2008/05/16
- bug#141: Process sentinel not called in batch mode, Eli Zaretskii, 2008/05/16
- bug#141: Process sentinel not called in batch mode, Stefan Monnier, 2008/05/18