Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set pipefail in a Makefile

Consider this Makfile:

all: 
    test 1 -eq 2 | cat
    echo 'done'

It will be executed with no error.

I've heard of set -o pipefail that I may use like this:

all: 
    set -o pipefail;     \
    test 1 -eq 2 | cat;  \
    echo 'done'

Apart that it does not work, this writing is very painful.

Another solution would be to use temporary files. I would like to avoid it.

What other solution can I use?

like image 822
nowox Avatar asked Nov 25 '15 20:11

nowox


1 Answers

You can force pipefail on as part of make's SHELL invocation From equivalent of pipefail in GNU make?

SHELL=/bin/bash -o pipefail
like image 127
John Avatar answered Oct 09 '22 04:10

John