From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 5322 invoked by alias); 25 Feb 2012 16:33:43 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 30268 Received: (qmail 19720 invoked from network); 25 Feb 2012 16:33:40 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED,RCVD_IN_DNSWL_LOW, T_DKIM_INVALID autolearn=no version=3.3.2 Received-SPF: pass (ns1.primenet.com.au: SPF record at _spf.google.com designates 209.85.215.43 as permitted sender) Received-SPF: pass (google.com: domain of dipakgaigole@gmail.com designates 10.152.128.38 as permitted sender) client-ip=10.152.128.38; Authentication-Results: mr.google.com; spf=pass (google.com: domain of dipakgaigole@gmail.com designates 10.152.128.38 as permitted sender) smtp.mail=dipakgaigole@gmail.com; dkim=pass header.i=dipakgaigole@gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=MCapxxKsSemx8OLX1Cuu455HL0Z1vrEWsptOn2oKK58=; b=fjoraNg7MFehD36Ea0fxuSWkX/7GwZjFFnHgzct3pBxB+GhLnFPRNOhmVyFNCJDtYa dQjO173WiQD4TZOI7y9ibXlVlCLVi+kV2lEXPnWHrQMWnM+iPLPXifU4ikY3RCd/WOLw pCElEq+eGtB8XLYMffg+HKToOMQKJ0g+tHyZU= MIME-Version: 1.0 In-Reply-To: <120224100518.ZM13322@torch.brasslantern.com> References: <120223081441.ZM2715@torch.brasslantern.com> <120224100518.ZM13322@torch.brasslantern.com> Date: Sat, 25 Feb 2012 22:03:33 +0530 Message-ID: Subject: Re: zsh behavior when fork() failed From: Dipak Gaigole To: Bart Schaefer Cc: zsh-workers@zsh.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Fri, Feb 24, 2012 at 11:35 PM, Bart Schaefer wrote: > On Feb 24, =A04:38pm, Dipak Gaigole wrote: > } > } As we can see that zsh continues even if it knows that it has failed > } in fork and finally the script return status is 0. > > The script return status is zero because the last command it executed > was successful. =A0That has nothing to do with the rest of the question. > Yes, I understand. > } Also checking for $? after each command is not feasible. So doesn't > } this zsh behavior looks misleading? > > Depends on whether fork failure is supposed to be fatal to the shell. > I looked at: > http://pubs.opengroup.org/onlinepubs/9699919799/utilities/V3_chap02.html > > Section 2.8.1 lists command execution failures where a non-interactive > shell "shall exit", but fork failure is not among them. Got it. But I don't want to add a check of $? after each command in the scripts specially in cases where scripts are 1000+ lines. Is there any zsh option to make sure script exit when fork fails? Else can I patch the zsh code to make script exit on fork failure? Thanks, Dipak