From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Zhu Zihao Newsgroups: gmane.emacs.devel Subject: Re: Forwarding stdout/stderr of a child process in batch mode Date: Sun, 06 Dec 2020 21:36:18 +0800 Message-ID: <86eek3qcod.fsf@163.com> References: Mime-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="2049"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: mu4e 1.4.13; emacs 27.1 Cc: emacs-devel@gnu.org To: Paul Pogonyshev Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sun Dec 06 14:42:41 2020 Return-path: Envelope-to: ged-emacs-devel@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 1kluJE-0000QT-Ra for ged-emacs-devel@m.gmane-mx.org; Sun, 06 Dec 2020 14:42:40 +0100 Original-Received: from localhost ([::1]:42978 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1kluJD-00045Z-U0 for ged-emacs-devel@m.gmane-mx.org; Sun, 06 Dec 2020 08:42:39 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:51362) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1kluDW-00014M-MH for emacs-devel@gnu.org; Sun, 06 Dec 2020 08:36:46 -0500 Original-Received: from mail-m973.mail.163.com ([123.126.97.3]:42292) by eggs.gnu.org with esmtps (TLS1.2:DHE_RSA_AES_256_CBC_SHA1:256) (Exim 4.90_1) (envelope-from ) id 1kluDK-0005Lw-TB for emacs-devel@gnu.org; Sun, 06 Dec 2020 08:36:44 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-ID:MIME-Version; bh=Yq4D0 Mu/E2x5S7Etz6nqG2TlbBL2WHlQO8RfF2DPyd4=; b=Eg76NTqEkZ8NBAMBaP7SE PFDwo2NjDjwmZ9bGVE8AQng+Y/43S8sZeDEBxl62a4oaeem4fHILktms8PUuoas9 /9SyvPjD+vcJzxYEjNy+bppOdR/k6eY2bmzN5pxIJjhhGen3RNGVqzfXv8MC3ONJ H7M8+7gsvx7tBw31Ayk05o= Original-Received: from asus-laptop (unknown [112.93.142.243]) by smtp3 (Coremail) with SMTP id G9xpCgDXitBY3sxf+6YLOQ--.4505S2; Sun, 06 Dec 2020 21:36:25 +0800 (CST) In-reply-to: X-CM-TRANSID: G9xpCgDXitBY3sxf+6YLOQ--.4505S2 X-Coremail-Antispam: 1Uf129KBjvdXoW7Jr47Ww4ruw43uFykuF48JFb_yoW3XFb_uw 1kJr47Gr4kJFnrXa1UGrW2yFW8G390gF98G3yUuw43Z34UAanrWan5GrnrtFWruF9Iqrs8 uwsFvas5Gr42kjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUeY2NtUUUUU== X-Originating-IP: [112.93.142.243] X-CM-SenderInfo: pdoosuxxwbztlvw6il2tof0z/xtbB8QLyr12MYIUEUAAAsO Received-SPF: pass client-ip=123.126.97.3; envelope-from=all_but_last@163.com; helo=mail-m973.mail.163.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: "Emacs-devel" Xref: news.gmane.io gmane.emacs.devel:260442 Archived-At: --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable IMO, in batch mode, `message` writes to stderr, `princ` writes to stdout. You can install a filter for childprocess, and run functions I mentioned above to forward these outputs. Paul Pogonyshev writes: > Hi, > > I'm using Emacs in batch mode. I need to invoke a child process that > is a longish operation (a few minutes). During this time, it writes to > its stdout, so user will see that it is working and what exactly is > being done. However, if I invoke it from Emacs (e.g. using > `call-process') I see no way of forwarding this output to the "real" > stdout. So, for a user this looks like the process (or batch Emacs on > top of it) is hung. > > Am I missing a way to forward output? > > Paul =2D-=20 Retrieve my PGP public key: https://meta.sr.ht/~citreu.pgp Zihao --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQFJBAEBCAAzFiEE7NCVzXX6efyusptG1SOVn+xGFqYFAl/M3lIVHGFsbF9idXRf bGFzdEAxNjMuY29tAAoJENUjlZ/sRhamLjEIALXzIWW4YxqUzJn6kO1rXVg5BTB4 7Ay08GYY6yMfvh1DuorrtL26sPxNOs/KsDIU1Gcj8TWb6flsRTI0sX7VupoOAVbE gxOweOAK8qPJWjzGUl3rLfcGXdNv9/87tjujiJ7ZVJuYwXYAzg1Lmq/gwfzvhw7I QkZhTjdHgYkOSbGnxSTpXYnDr82Rjv4cYGzcJUzN7+ZnzzudZAeQ1ODq6vg8aJ/u NMOmYNPSrZMux1icynajxsiQQuRCALVkDlQ9vqbLAWxPOaMdkIKkhvpEc/MiIhv6 S4vzMMa5/L/68AKyrvLfNnqePB8fWXKzSsTTJ9UHcn5gMcbCTeU9T49i+9g= =xpix -----END PGP SIGNATURE----- --=-=-=--