From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#46388: 27.1; emacs -batch does not output messages immediately when invoked outside of the command prompt Date: Thu, 11 Feb 2021 16:09:28 +0200 Message-ID: <831rdmitlz.fsf@gnu.org> References: <83h7mlj75u.fsf@gnu.org> <83eehpj640.fsf@gnu.org> <83pn17j4pw.fsf@gnu.org> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24560"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 46388@debbugs.gnu.org To: Ioannis Kappas , Paul Eggert Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Feb 11 15:13:38 2021 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lACiw-0006IQ-7f for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 11 Feb 2021 15:13:38 +0100 Original-Received: from localhost ([::1]:39456 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lACiv-0004Uv-9o for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 11 Feb 2021 09:13:37 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:53952) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lACfV-0001Kc-Hd for bug-gnu-emacs@gnu.org; Thu, 11 Feb 2021 09:10:09 -0500 Original-Received: from debbugs.gnu.org ([209.51.188.43]:46498) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1lACfS-0004am-81 for bug-gnu-emacs@gnu.org; Thu, 11 Feb 2021 09:10:03 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1lACfS-0006l5-0r for bug-gnu-emacs@gnu.org; Thu, 11 Feb 2021 09:10:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 11 Feb 2021 14:10:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 46388 X-GNU-PR-Package: emacs Original-Received: via spool by 46388-submit@debbugs.gnu.org id=B46388.161305257625929 (code B ref 46388); Thu, 11 Feb 2021 14:10:01 +0000 Original-Received: (at 46388) by debbugs.gnu.org; 11 Feb 2021 14:09:36 +0000 Original-Received: from localhost ([127.0.0.1]:58044 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lACf2-0006k8-IW for submit@debbugs.gnu.org; Thu, 11 Feb 2021 09:09:36 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:35970) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1lACey-0006js-IG for 46388@debbugs.gnu.org; Thu, 11 Feb 2021 09:09:34 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:41835) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lACer-0004LR-Hg; Thu, 11 Feb 2021 09:09:25 -0500 Original-Received: from 84.94.185.95.cable.012.net.il ([84.94.185.95]:1687 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1lACeq-000414-L5; Thu, 11 Feb 2021 09:09:25 -0500 In-Reply-To: (message from Ioannis Kappas on Thu, 11 Feb 2021 08:10:34 +0000) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:199812 Archived-At: > From: Ioannis Kappas > Date: Thu, 11 Feb 2021 08:10:34 +0000 > Cc: 46388@debbugs.gnu.org > > > My reading of the code is that we already fflush stderr after emitting > > a message, so this should already happen. See message_to_stderr. If > > that still doesn't help, then there's some buffering in the OS (for > > example, in the pipe machinery itself), which we cannot control. > > the xdisp.c:message_to_stderr() is the first function i studied with > gdb when I started the investigation. Unless I've missed something, > it does not seem to lead to calling fflush (under windows at least): Then maybe this: > /* Return the error output stream. */ > static FILE * > errstream (void) > { > FILE *err = buferr; > if (!err) > return stderr; > fflush_unlocked (stderr); <<<<<<<<<<<<<<<< > return err; > } should be fixed to fflush 'buferr' instead (or in addition to stderr)? Paul, isn't that a bug that we fflush stderr here, and not 'buferr'?