[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Catching errors in pipes
From: |
Paul Smith |
Subject: |
Re: Catching errors in pipes |
Date: |
Sun, 24 Mar 2024 17:04:46 -0400 |
User-agent: |
Evolution 3.52.0 (by Flathub.org) |
On Tue, 2023-12-05 at 13:43 +0100, Sébastien Hinderer wrote:
> Is there a recommended way to catch errors in pipelines of coommands
> that are used in recipes, please?
This isn't a GNU Make issue. It's a shell programming issue.
Make just invokes the shell and waits for it to exit, then looks at the
exit code. If you want the behavior of pipefail you have to get your
recipe to implement that behavior: there's nothing make can do about
it.
I recommend checking on StackOverflow or similar places looking for
idioms that will support this for POSIX shells.
Just to note, starting with the next POSIX version, set -o pipefail is
part of the standard so you can expect it to start appearing in POSIX-
conforming shells that don't already support it. Of course, that
doesn't help if you must support older shells.
--
Paul D. Smith <psmith@gnu.org> Find some GNU Make tips at:
https://www.gnu.org http://make.mad-scientist.net
"Please remain calm...I may be mad, but I am a professional." --Mad
Scientist
- Re: Catching errors in pipes,
Paul Smith <=