[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: Question WHY is gnu make does not stop on error on rule
From: |
Cook, Malcolm |
Subject: |
RE: Question WHY is gnu make does not stop on error on rule |
Date: |
Thu, 8 Dec 2022 21:40:07 +0000 |
> On Thu, 2022-12-08 at 19:59 +0100, aotto wrote:
> > HA HA HA - I fund the bug !!
> >
> > I used "-silent" and not "--silent", the "-silent" is parsed as
>
> That's funny, but I'm not sure why it works differently in 4.4 since that was
> still the case in 4.3, if you use "-silent".
>
> > MqC.mq.$(MAKE_LNG): | MqC.mq.$(MAKE_LNG).before
> > MqC.mq.$(MAKE_LNG).after
>
> This usage is dangerous, because:
>
> $ false
> $ echo $?
> 1
>
> $ false | cat
> $ echo $?
> 0
>
> See how the pipeline swallowed the failing exit code? The exit code of a
> pipeline is always the exit code of the last statement in the pipeline (here,
> the
> "cat" program).
>
> If you want to require bash you can use something like:
>
> SHELL := /bin/bash
> .SHELLFLAGS = -o pipefail -c
>
> which will force the exit code of a pipeline to be the exit code of the last
> failing command, not the last command.
I'd add that if you're doing this you'll want to use
.ONESHELL:
to ensure that multiple lines of a recipe execute one after each other in the
same process.
>
> If you don't want to require bash, you'll have to get a LOT fancier than
> simply
> adding a pipe in a variable, if you want to preserve exit codes.
>
- Question WHY is gnu make does not stop on error on rule, aotto, 2022/12/08
- Re: Question WHY is gnu make does not stop on error on rule, Paul Smith, 2022/12/08
- Re: Question WHY is gnu make does not stop on error on rule, aotto, 2022/12/08
- Re: Question WHY is gnu make does not stop on error on rule, Kaz Kylheku, 2022/12/08
- Re: Question WHY is gnu make does not stop on error on rule, Paul Smith, 2022/12/08
- Re: Question WHY is gnu make does not stop on error on rule, aotto, 2022/12/08
- Re: Question WHY is gnu make does not stop on error on rule, aotto, 2022/12/08
- Re: Question WHY is gnu make does not stop on error on rule, Paul Smith, 2022/12/08
- Re: Question WHY is gnu make does not stop on error on rule, aotto, 2022/12/08
- RE: Question WHY is gnu make does not stop on error on rule,
Cook, Malcolm <=