From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tino Calancha Newsgroups: gmane.emacs.bugs Subject: bug#23206: 25.0.92; dired-shell-stuff-it: wait until all parallel jobs finish Date: Mon, 4 Apr 2016 01:38:52 +0900 (JST) Message-ID: References: <837fgeraxz.fsf@gnu.org> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; format=flowed; charset=US-ASCII X-Trace: ger.gmane.org 1459701381 31080 80.91.229.3 (3 Apr 2016 16:36:21 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sun, 3 Apr 2016 16:36:21 +0000 (UTC) Cc: Tino Calancha , 23206@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sun Apr 03 18:36:12 2016 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1aml0V-0002hQ-4A for geb-bug-gnu-emacs@m.gmane.org; Sun, 03 Apr 2016 18:36:11 +0200 Original-Received: from localhost ([::1]:54336 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aml0U-00058s-HE for geb-bug-gnu-emacs@m.gmane.org; Sun, 03 Apr 2016 12:36:10 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:53345) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aml0Q-00058b-OC for bug-gnu-emacs@gnu.org; Sun, 03 Apr 2016 12:36:07 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aml0M-0004pm-MW for bug-gnu-emacs@gnu.org; Sun, 03 Apr 2016 12:36:06 -0400 Original-Received: from debbugs.gnu.org ([208.118.235.43]:53003) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aml0M-0004pi-Iw for bug-gnu-emacs@gnu.org; Sun, 03 Apr 2016 12:36:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1aml0M-0000pv-CS for bug-gnu-emacs@gnu.org; Sun, 03 Apr 2016 12:36:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Tino Calancha Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sun, 03 Apr 2016 16:36:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 23206 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 23206-submit@debbugs.gnu.org id=B23206.14597013423189 (code B ref 23206); Sun, 03 Apr 2016 16:36:02 +0000 Original-Received: (at 23206) by debbugs.gnu.org; 3 Apr 2016 16:35:42 +0000 Original-Received: from localhost ([127.0.0.1]:50130 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aml02-0000pN-2H for submit@debbugs.gnu.org; Sun, 03 Apr 2016 12:35:42 -0400 Original-Received: from calancha-ilc.kek.jp ([130.87.234.234]:55378) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1aml00-0000pA-KJ for 23206@debbugs.gnu.org; Sun, 03 Apr 2016 12:35:41 -0400 Original-Received: by calancha-ilc.kek.jp (Postfix, from userid 500) id 66C1D5646; Mon, 4 Apr 2016 01:38:52 +0900 (JST) Original-Received: from localhost (localhost [127.0.0.1]) by calancha-ilc.kek.jp (Postfix) with ESMTP id 0BA825459; Mon, 4 Apr 2016 01:38:52 +0900 (JST) X-X-Sender: calancha@calancha-ilc.kek.jp In-Reply-To: <837fgeraxz.fsf@gnu.org> User-Agent: Alpine 2.20 (LRH 67 2015-01-07) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:115940 Archived-At: > Thanks. Can you elaborate on why such a wait is needed? Let's assume COMMAND is "du -s" and LIST contains the dirs foo bar baz: foo is ~ Gb with depth > 1 and bar and baz are few kB dirs with depth 1. The effective shell command to run is: du -s foo& du -s bar& du -s baz& This creates a new process PROC in the system. PROC returns with the return code of the last command in the list (du -s baz): this is a shell feature. The output from the remaining jobs is still comming to stdout, but is not associated to PROC, which already succeded. With `dired-do-shell-command', we get all output only if foo is the last dir in LIST. POSIX shells provide the builtin 'wait' to change this behaviour: it forces PROC to wait until all background jobs end. You can run from terminal following scripts: I) #!/bin/sh echo "id $$" du -s foo& du -s bar& du -s baz& II) #!/bin/sh echo "id $$" du -s foo& du -s bar& du -s baz& wait Then list the process id of the scripts while you still have output comming: ps -f -p ID I) No process in the system with ID. II) There is a process with ID. Well, maybe it can be solve in many other ways. I just found very simple: just adding 4 letters fix it; also very natural, because we are building a shell command, so its logical to use the shell sintaxis.