From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.bugs Subject: bug#141: Process sentinel not called in batch mode Date: Tue, 13 May 2008 19:28:04 -0400 Message-ID: <87hcd1kcmz.fsf__15190.213910728$1210722767$gmane$org@stupidchicken.com> Reply-To: Chong Yidong , 141@emacsbugs.donarmstrong.com NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1210722723 14376 80.91.229.12 (13 May 2008 23:52:03 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Tue, 13 May 2008 23:52:03 +0000 (UTC) Cc: 141@emacsbugs.donarmstrong.com, Helmut Eller To: emacs-devel@gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Wed May 14 01:52:38 2008 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1Jw4IK-00087J-RQ for geb-bug-gnu-emacs@m.gmane.org; Wed, 14 May 2008 01:52:33 +0200 Original-Received: from localhost ([127.0.0.1]:42132 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jw4Hb-0003vF-Su for geb-bug-gnu-emacs@m.gmane.org; Tue, 13 May 2008 19:51:47 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Jw4HX-0003tZ-RQ for bug-gnu-emacs@gnu.org; Tue, 13 May 2008 19:51:43 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Jw4HW-0003rv-AL for bug-gnu-emacs@gnu.org; Tue, 13 May 2008 19:51:43 -0400 Original-Received: from [199.232.76.173] (port=47380 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Jw4HW-0003rm-6I for bug-gnu-emacs@gnu.org; Tue, 13 May 2008 19:51:42 -0400 Original-Received: from rzlab.ucr.edu ([138.23.92.77]:42130) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1Jw4HW-0000hN-3B for bug-gnu-emacs@gnu.org; Tue, 13 May 2008 19:51:42 -0400 Original-Received: from rzlab.ucr.edu (rzlab.ucr.edu [127.0.0.1]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m4DNpeYx025428; Tue, 13 May 2008 16:51:40 -0700 Original-Received: (from debbugs@localhost) by rzlab.ucr.edu (8.13.8/8.13.8/Submit) id m4DNZ4tE018259; Tue, 13 May 2008 16:35:04 -0700 X-Loop: don@donarmstrong.com Resent-From: Chong Yidong Resent-To: bug-submit-list@donarmstrong.com Resent-CC: Emacs Bugs Resent-Date: Tue, 13 May 2008 23:35:04 +0000 Resent-Message-ID: Resent-Sender: don@donarmstrong.com X-Emacs-PR-Message: report 141 X-Emacs-PR-Package: emacs X-Emacs-PR-Keywords: Original-Received: via spool by 141-submit@emacsbugs.donarmstrong.com id=B141.121072129115906 (code B ref 141); Tue, 13 May 2008 23:35:04 +0000 Original-Received: (at 141) by emacsbugs.donarmstrong.com; 13 May 2008 23:28:11 +0000 Original-Received: from cyd.mit.edu (CYD.MIT.EDU [18.115.2.24]) by rzlab.ucr.edu (8.13.8/8.13.8/Debian-3) with ESMTP id m4DNS8XA015900 for <141@emacsbugs.donarmstrong.com>; Tue, 13 May 2008 16:28:09 -0700 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, 3) Resent-Date: Tue, 13 May 2008 19:51:43 -0400 X-BeenThere: bug-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:17996 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