Hi,
I have a problem that gnu make doesn't give up after an error in a command in a
pipe. I have attached a simple example.
I run a command (ls) and the output is piped to command 'tee' to send the
output of 'ls' to a file and stdout. Normally the shell returns the exit code
of the last command in a pipe. In this case it is tee, which returns 0 even if
'ls' fails. Therefore I set the shell option "-o pipefail" so that the last
non-zero return code of a command in a pipe is returned.
But gnu-make still continues after a failing 'ls adsfafa' command. When I echo
the exit code ($?) you can see that it is non-zero. How can I make that
gnu-make stops after the first failing ls command?
Here is the output when I type make:
echo SHELL=/bin/ksh -e -o pipefail
SHELL=/bin/ksh -e -o pipefail
ls > ls.log ;echo $?
0
ls adsfafa | tee -i ls.log
ls: adsfafa: No such file or directory
ls adsfafa | tee -i ls.log ;echo $?
ls: adsfafa: No such file or directory
1
ls bbbbb | tee -i ls.log
ls: bbbbb: No such file or directory
I used shell /bin/ksh, which is on our system "sh (AT&T Labs Research)
1993-12-28". I you want to test this with "bash" you need version 3 to have
support for the -o pipefail option. We don't have bash 3 on our system, only
bash version 2.05.
I tried gnu-make version 3.81
--
Erwin Waterlander
SHELL=/bin/ksh -e -o pipefail
ls :
echo SHELL=${SHELL}
ls > ls.log ;echo $$?
ls adsfafa | tee -i ls.log
ls adsfafa | tee -i ls.log ;echo $$?
ls bbbbb | tee -i ls.log
_______________________________________________
Bug-make mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-make