unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* Process sentinel not called in batch mode
@ 2008-04-15 14:48 ` Helmut Eller
  2008-05-19 16:40   ` bug#141: marked as done (Process sentinel not called in batch mode) Emacs bug Tracking System
  0 siblings, 1 reply; 2+ messages in thread
From: Helmut Eller @ 2008-04-15 14:48 UTC (permalink / raw)
  To: bug-gnu-emacs


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 start-subprocess ()
  (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)))
    proc))

(defun print-status (proc)
  (message "%s status: %s exit-status: %s sentinel-called: %s" 
	   proc (process-status proc) (process-exit-status proc) 
	   sentinel-called))

(defun main ()
  (let ((proc (start-subprocess)))
    (while (not sentinel-called)
      (print-status proc)
      (sit-for 1)
      (accept-process-output proc 1))
    (print-status proc)))

(main)

$shell> emacs -Q -batch -l test-sentinel.el
test status: run exit-status: 0 sentinel-called: nil
test status: exit exit-status: 20 sentinel-called: nil
test status: exit exit-status: 20 sentinel-called: nil
test status: exit exit-status: 20 sentinel-called: nil
test status: exit exit-status: 20 sentinel-called: nil

[Exit 130 (SIGINT)]
$shell>

Emacs can obviously detect that the suprocess has terminated but the
sentinel is never called.  This used to work with Emacs 20.7 and for
certain variants of the 22.0.50 series.

Helmut.


In GNU Emacs 23.0.60.8 (i686-pc-linux-gnu, GTK+ Version 2.8.20)
 of 2008-03-14 on xaital
Windowing system distributor `The X.Org Foundation', version 11.0.70101000
configured using `configure  '--with-jpeg=no' '--with-gif=no' '--with-tiff=no' '--with-xft' '--without-dbus' '--without-sound''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  value of $XMODIFIERS: nil
  locale-coding-system: nil
  default-enable-multibyte-characters: nil

Major mode: Emacs-Lisp

Minor modes in effect:
  outline-minor-mode: t
  display-time-mode: t
  show-paren-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  global-auto-composition-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<up> <up> <up> <down> <down> <up> <up> <up> <up> <up> 
<up> <up> <down> <down> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <right> <right> <left> <left> <left> 
<left> <left> <left> C-d C-M-x C-x C-s <down> C-e <down> 
<down> <up> C-x C-e <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> C-x C-e C-x b * M e <tab> <return> <up> <up> 
<up> <up> <up> <up> <up> <up> <up> <up> <up> C-x b 
<return> <up> <up> <up> <up> <up> <up> <up> <up> <up> 
<up> <up> <up> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> C-a C-d C-d 
C-d <up> <up> <up> <up> C-e <down> <down> C-e C-x C-s 
<down> <down> C-x C-s <up> <up> <up> <up> <up> <up> 
<up> <up> <up> <up> <up> <up> <up> <up> <up> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <up> <down> <down> <down> <down> 
<down> <down> <up> <up> C-x C-e <up> <up> <up> <up> 
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> 
<up> <up> <up> <right> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> s e e <backspace> 
<backspace> l e e p 1 SPC ; SPC <left> <left> C-e C-x 
C-s <left> <left> <left> <left> <left> <left> <left> 
<left> <left> <left> <left> <left> <left> <left> <left> 
SPC C-x C-s <left> <left> <left> <left> <left> <left> 
<left> <left> <left> <left> <left> <left> <left> <left> 
<left> <left> <left> <left> <right> <right> b a C-x 
C-s M-x r e p SPC o <tab> SPC t SPC <backspace> r <tab> 
<return>

Recent messages:
test status: exit exit-status: 20 sentinel-called: t
"test status: exit exit-status: 20 sentinel-called: t"
Wrote /home/helmut/elisp/test-sentinel.el
(No changes need to be saved)
test status: run exit-status: 0 sentinel-called: t
"test status: run exit-status: 0 sentinel-called: t"
sentinel: #<process test> exited abnormally with code 20

Wrote /home/helmut/elisp/test-sentinel.el [3 times]
Making completion list... [3 times]





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

* bug#141: marked as done (Process sentinel not called in batch mode)
  2008-04-15 14:48 ` Process sentinel not called in batch mode Helmut Eller
@ 2008-05-19 16:40   ` Emacs bug Tracking System
  0 siblings, 0 replies; 2+ messages in thread
From: Emacs bug Tracking System @ 2008-05-19 16:40 UTC (permalink / raw)
  To: Chong Yidong

[-- Attachment #1: Type: text/plain, Size: 856 bytes --]


Your message dated Mon, 19 May 2008 12:26:36 -0400
with message-id <873aoe5kg3.fsf@stupidchicken.com>
and subject line Re: bug#141: Process sentinel not called in batch mode
has caused the Emacs bug report #141,
regarding Process sentinel not called in batch mode
to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact don@donarmstrong.com
immediately.)


-- 
141: http://emacsbugs.donarmstrong.com/cgi-bin/bugreport.cgi?bug=141
Emacs Bug Tracking System
Contact don@donarmstrong.com with problems

[-- Attachment #2: Type: message/rfc822, Size: 9668 bytes --]

From: Helmut Eller <eller.helmut@gmail.com>
To: bug-gnu-emacs@gnu.org
Subject: Process sentinel not called in batch mode
Date: Tue, 15 Apr 2008 16:48:00 +0200
Message-ID: <m2r6d7uqcf.fsf@gmail.com>


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 start-subprocess ()
  (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)))
    proc))

(defun print-status (proc)
  (message "%s status: %s exit-status: %s sentinel-called: %s" 
	   proc (process-status proc) (process-exit-status proc) 
	   sentinel-called))

(defun main ()
  (let ((proc (start-subprocess)))
    (while (not sentinel-called)
      (print-status proc)
      (sit-for 1)
      (accept-process-output proc 1))
    (print-status proc)))

(main)

$shell> emacs -Q -batch -l test-sentinel.el
test status: run exit-status: 0 sentinel-called: nil
test status: exit exit-status: 20 sentinel-called: nil
test status: exit exit-status: 20 sentinel-called: nil
test status: exit exit-status: 20 sentinel-called: nil
test status: exit exit-status: 20 sentinel-called: nil

[Exit 130 (SIGINT)]
$shell>

Emacs can obviously detect that the suprocess has terminated but the
sentinel is never called.  This used to work with Emacs 20.7 and for
certain variants of the 22.0.50 series.

Helmut.


In GNU Emacs 23.0.60.8 (i686-pc-linux-gnu, GTK+ Version 2.8.20)
 of 2008-03-14 on xaital
Windowing system distributor `The X.Org Foundation', version 11.0.70101000
configured using `configure  '--with-jpeg=no' '--with-gif=no' '--with-tiff=no' '--with-xft' '--without-dbus' '--without-sound''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: nil
  value of $XMODIFIERS: nil
  locale-coding-system: nil
  default-enable-multibyte-characters: nil

Major mode: Emacs-Lisp

Minor modes in effect:
  outline-minor-mode: t
  display-time-mode: t
  show-paren-mode: t
  mouse-wheel-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  global-auto-composition-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<up> <up> <up> <down> <down> <up> <up> <up> <up> <up> 
<up> <up> <down> <down> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <right> <right> <left> <left> <left> 
<left> <left> <left> C-d C-M-x C-x C-s <down> C-e <down> 
<down> <up> C-x C-e <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> C-x C-e C-x b * M e <tab> <return> <up> <up> 
<up> <up> <up> <up> <up> <up> <up> <up> <up> C-x b 
<return> <up> <up> <up> <up> <up> <up> <up> <up> <up> 
<up> <up> <up> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <down> <down> C-a C-d C-d 
C-d <up> <up> <up> <up> C-e <down> <down> C-e C-x C-s 
<down> <down> C-x C-s <up> <up> <up> <up> <up> <up> 
<up> <up> <up> <up> <up> <up> <up> <up> <up> <down> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <up> <down> <down> <down> <down> 
<down> <down> <up> <up> C-x C-e <up> <up> <up> <up> 
<up> <up> <up> <up> <up> <up> <up> <up> <up> <up> <up> 
<up> <up> <up> <right> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> <right> <right> 
<right> <right> <right> <right> <right> s e e <backspace> 
<backspace> l e e p 1 SPC ; SPC <left> <left> C-e C-x 
C-s <left> <left> <left> <left> <left> <left> <left> 
<left> <left> <left> <left> <left> <left> <left> <left> 
SPC C-x C-s <left> <left> <left> <left> <left> <left> 
<left> <left> <left> <left> <left> <left> <left> <left> 
<left> <left> <left> <left> <right> <right> b a C-x 
C-s M-x r e p SPC o <tab> SPC t SPC <backspace> r <tab> 
<return>

Recent messages:
test status: exit exit-status: 20 sentinel-called: t
"test status: exit exit-status: 20 sentinel-called: t"
Wrote /home/helmut/elisp/test-sentinel.el
(No changes need to be saved)
test status: run exit-status: 0 sentinel-called: t
"test status: run exit-status: 0 sentinel-called: t"
sentinel: #<process test> exited abnormally with code 20

Wrote /home/helmut/elisp/test-sentinel.el [3 times]
Making completion list... [3 times]





[-- Attachment #3: Type: message/rfc822, Size: 2298 bytes --]

From: Chong Yidong <cyd@stupidchicken.com>
To: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: Eli Zaretskii <eliz@gnu.org>, rms@gnu.org, 141-done@emacsbugs.donarmstrong.com, eller.helmut@gmail.com, emacs-devel@gnu.org
Subject: Re: bug#141: Process sentinel not called in batch mode
Date: Mon, 19 May 2008 12:26:36 -0400
Message-ID: <873aoe5kg3.fsf@stupidchicken.com>

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>>>>> But if we're in wait_reading_process_output, that means that idle or
>>>>> not, we're checking for process output, so why not check for process
>>>>> status changes as well?
>>> 
>>>> Because status_notify has a side effect of triggering redisplay.
>>> 
>>> Thanks.  Now it makes a lot more sense.  Please add a corresponding
>>> comment on the do_display check.
>
>> What do you think should be the fix for the original problem?
>
> The one you proposed seems right,

OK.  I've checked it in.


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

end of thread, other threads:[~2008-05-19 16:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <873aoe5kg3.fsf@stupidchicken.com>
2008-04-15 14:48 ` Process sentinel not called in batch mode Helmut Eller
2008-05-19 16:40   ` bug#141: marked as done (Process sentinel not called in batch mode) Emacs bug Tracking System

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).