Ill-behaved `gcc -E ... | head` exit status?

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

 



$ gcc -E - <<< '#include <stdio.h>' | head -n 1
# 1 "<stdin>"
$ declare -p PIPESTATUS
declare -a PIPESTATUS=([0]="2" [1]="0")
$ gcc --version
gcc (Debian 10.2.1-6) 10.2.1 20210110
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

gcc returns 2 in the above example. This does not follow the standard
convention on Linux.

For example, the exit status of seq is 141 which corresponds to a
SIGPIPE signal.

$ seq 1000000 | head -n 1
1
$ declare -p PIPESTATUS
declare -a PIPESTATUS=([0]="141" [1]="0")

Should gcc conform to this standard as well? Thanks.

-- 
Regards,
Peng



[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux