From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: Process sentinel not called in batch mode Date: Tue, 13 May 2008 19:28:04 -0400 Message-ID: <87hcd1kcmz.fsf@stupidchicken.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1210721307 10990 80.91.229.12 (13 May 2008 23:28:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 13 May 2008 23:28:27 +0000 (UTC) Cc: 141@emacsbugs.donarmstrong.com, Helmut Eller To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed May 14 01:29:03 2008 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Jw3vY-0002D8-84 for ged-emacs-devel@m.gmane.org; Wed, 14 May 2008 01:29:00 +0200 Original-Received: from localhost ([127.0.0.1]:37473 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jw3uo-0004Bn-OC for ged-emacs-devel@m.gmane.org; Tue, 13 May 2008 19:28:14 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Jw3uk-0004BL-Sx for emacs-devel@gnu.org; Tue, 13 May 2008 19:28:10 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Jw3ui-0004An-8H for emacs-devel@gnu.org; Tue, 13 May 2008 19:28:09 -0400 Original-Received: from [199.232.76.173] (port=35478 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jw3ui-0004Ak-5s for emacs-devel@gnu.org; Tue, 13 May 2008 19:28:08 -0400 Original-Received: from cyd.mit.edu ([18.115.2.24]:52565) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Jw3ui-00068O-AA for emacs-devel@gnu.org; Tue, 13 May 2008 19:28:08 -0400 Original-Received: by cyd.mit.edu (Postfix, from userid 1000) id C783A4E392; Tue, 13 May 2008 19:28:04 -0400 (EDT) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:97103 Archived-At: Helmut Eller 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