From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on inbox.vuxu.org X-Spam-Level: X-Spam-Status: No, score=-3.3 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED,T_SCC_BODY_TEXT_LINE, UNPARSEABLE_RELAY autolearn=ham autolearn_force=no version=3.4.4 Received: (qmail 16803 invoked from network); 27 Mar 2022 17:33:27 -0000 Received: from zero.zsh.org (2a02:898:31:0:48:4558:7a:7368) by inbox.vuxu.org with ESMTPUTF8; 27 Mar 2022 17:33:27 -0000 ARC-Seal: i=1; cv=none; a=rsa-sha256; d=zsh.org; s=rsa-20210803; t=1648402407; b=pm29kTqzpTBwbfuKPwiNdRHfnNEJ+FGk53r7t95i4ZwMgf4VztDIt0HfQCX+vqC5hEE2BezMDQ r/TmxWGDLuTqDej4bFTvEnP7ZPtfp3oYLTFJq06CQtQpijUDx+IEiLbM+Deuu0ePnm9JamsQxx 1NxagpSyCUsIU6vgK0neJhjuMK12esUoi6xurPD6YxfkbtUlGPLfICky+Fgyz0YdACRwgB2nds BCsyl+75X3axZPGYRJavHPJG0Wknz18pTStSOdmxughHjWtqnw4f9cSgVobg2g2gynLwvkL6TF Nmmk/7ACynX8Wz7w9gQg9O0aws2dlMhXXJx5HFa+lJYqnA==; ARC-Authentication-Results: i=1; zsh.org; iprev=pass (granite.fifsource.com) smtp.remote-ip=173.255.216.206; dmarc=none header.from=fifi.org; arc=none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed; d=zsh.org; s=rsa-20210803; t=1648402407; bh=2qHFpaTFzjGwLTS9CbfpzPWFQzpmE8XH3BV4LR2pW7I=; h=List-Archive:List-Owner:List-Post:List-Unsubscribe:List-Subscribe:List-Help: List-Id:Sender:Content-Transfer-Encoding:MIME-Version:Content-Type: References:In-Reply-To:Date:Cc:To:From:Subject:Message-ID:DKIM-Signature; b=QJtG87cj3vA1RvMVfqQZijYqhh9L4+1gTFR9t/O+zVt9l4j12syc93I8w8sHyhtT/wK9sPvNh2 AB/t/kDMcnexDv25PKbV5xgrrDW30W76oVIVvKuwkZs32xroyXUtqCmSV4ZqM6Bemcz25d8oLf dlcfeBPq4HCJWvEjsbEJWyuUNPXkGaFUAdlJ/si5+P/TUAUSdYVAPHbRrKcOVf3Is3FDFWPnJv fEx31QUViwMKeOzSbm8Va8aydtvw6lMIdkXxNgxXC0yIhNlyF29zRuHHzSev+PDVE25KtGMLo+ DJGLUAUpcyKYvoxQWsg+rqNb6tNqMqAnkJyKXBw2bn8Y8Q==; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=zsh.org; s=rsa-20210803; h=List-Archive:List-Owner:List-Post:List-Unsubscribe: List-Subscribe:List-Help:List-Id:Sender:Content-Transfer-Encoding: MIME-Version:Content-Type:References:In-Reply-To:Date:Cc:To:From:Subject: Message-ID:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID; bh=HQHtuUNdLL38pkFB6SnNs0RwtACENJ8v45Rc1p1U/mE=; b=A/oTeMnK3Z14b62CHJmg1QoESt Ikalb6t92Yh4OQ+jiznI22PntPF49prYEtMvYlTRoHVEfUDpp9KuoyF7flbimUwALxO5NdoADalHo 3mArcsQldBpxIs0NfVt8+lrIpzjcP+3BU8ce1DwuxHaJDn4QCG7SXjypXXMUFw0cZErzdDApdKr6c r7DMXf+GwtIv/2LTovrXNTfMQ15GJrduTH/7lYr5rUAA8vYCr0GX/6vOFGRwrdXMDpOIecW9687D7 noydMAU0O/Gkcc/W9/ikj2aS9XAg8l8GB1X7b9I7y8oiDi68LP2sPW+oLu0eHRy1cLolH98t/1sd/ PNfdTqxg==; Received: from authenticated user by zero.zsh.org with local id 1nYWlZ-0001VX-V4; Sun, 27 Mar 2022 17:33:25 +0000 Authentication-Results: zsh.org; iprev=pass (granite.fifsource.com) smtp.remote-ip=173.255.216.206; dmarc=none header.from=fifi.org; arc=none Received: from granite.fifsource.com ([173.255.216.206]:53124) by zero.zsh.org with esmtps (TLS1.2:ECDHE-RSA-AES256-GCM-SHA384:256) id 1nYWkr-0000lD-Kc; Sun, 27 Mar 2022 17:32:42 +0000 Received: from ceramic.fifi.org (107-142-44-66.lightspeed.sntcca.sbcglobal.net [107.142.44.66]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by granite.fifsource.com (Postfix) with ESMTPSA id A7B2F4076; Sun, 27 Mar 2022 10:32:39 -0700 (PDT) Message-ID: Subject: Re: Parallel processing From: Philippe Troin To: Bart Schaefer Cc: Perry Smith , Zsh Users Date: Sun, 27 Mar 2022 10:32:39 -0700 In-Reply-To: References: <1E0E1226-E3E8-40AD-87CD-93A602B1B08B@easesoftware.com> <36966db7bf519a888d7daca39fdd39f1e39b8511.camel@fifi.org> Content-Type: text/plain; charset="UTF-8" User-Agent: Evolution 3.42.4 (3.42.4-1.fc35) MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Seq: 27628 Archived-At: X-Loop: zsh-users@zsh.org Errors-To: zsh-users-owner@zsh.org Precedence: list Precedence: bulk Sender: zsh-users-request@zsh.org X-no-archive: yes List-Id: List-Help: List-Subscribe: List-Unsubscribe: List-Post: List-Owner: List-Archive: On Sat, 2022-03-26 at 15:19 -0700, Bart Schaefer wrote: > On Sat, Mar 26, 2022 at 11:10 AM Philippe Troin wrote: > > > > Anyways, zargs is not doing a stellar job currently with collecting > > exit statuses from commands ran in parallel: > > # Everything has to be in a subshell just in case of backgrounding jobs, > # so that we don't unintentionally "wait" for jobs of the parent shell. > > Hmm ... zargs uses > wait ${${jobstates[(R)running:*]/#*:/}/%=*/} > to wait for all the backgrounded jobs that it started. (This causes a > segfault in the most recent git checkout if zargs itself is a subshell > job.) However, that "wait" returns the exit status of only one of > those jobs. There might be something more that could be done now, to > pick up the status of the rest ... but I'm reluctant to mess with that > while the segfault is unfixed. > > > % zargs -n 4 -P 2 -- 0 1 -- zsh -c 'sleep $1 ; exit $1 ' -; echo $? > > 123 > > This is explained in the comments in zargs: > > # Like xargs, zargs exits with the following status: > # 0 if it succeeds > # 123 if any invocation of the command exited with status 1-125 > # 124 if the command exited with status 255 > # 125 if the command is killed by a signal > # 126 if the command cannot be run > # 127 if the command is not found > # 1 if some other error occurred. I was referring to the fact that zargs misses the exit status of subcommands: % zargs -n 4 -P 2 -- 1 0 -- zsh -c 'sleep $1 ; exit $1 ' -; echo $? 0 % zargs -n 4 -P 2 -- 0 1 -- zsh -c 'sleep $1 ; exit $1 ' -; echo $? 123 Both zargs invocation will spawn two subcommands. In both cases one subcommand will exit with status 0 and the other with status 1. In the first invocation, zargs misses that one of the subshells returns non-zero exit status. Phil.