help-make
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

RE: Catching errors in pipes


From: Cook, Malcolm
Subject: RE: Catching errors in pipes
Date: Tue, 5 Dec 2023 18:54:27 +0000

> Is there a recommended way to catch errors in pipelines of coommands that
> are used in recipes, please?

I use the following with good success:

SHELL=/usr/bin/bash
.SHELLFLAGS = -eu -o pipefail -c

FWIW: I usually use the above in combination with:

.ONESHELL:
MAKEFLAGS += --no-builtin-rules
MAKEFLAGS += --no-builtin-variables
MAKEFLAGS += --output-sync
MAKEFLAGS += --warn-undefined-variables
.DELETE_ON_ERROR:
.SUFFIXES:
.SECONDEXPANSION:

> If so, how backward-compatible are they?

To my knowledge this has always had the same results.

> I saw the .SHELLFLAGS variable but also found a bug report saying that its
> content is passed to the shell as one single argument. Is it thus mandatory to
> prefix every pipeline with set -o pipefail; or is there a more global way to 
> get
> the desired behaviour?

If you reference this report you might get a reply that considers it.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]