cygwin 2.0.2, make 4.1: stderr redirect append does not work with native Windows programs

Lemke, Michael ST/HZA-ZSW
Wed May 13 10:34:00 GMT 2015

On May 12, 2015 9:59 PM Scott McPeak wrote:
>Using 32-bit cygwin 2.0.2 and make 4.1-1, in a recipe, redirecting
>stderr in append mode does not work if the program being invoked on a
>shell line is a native Windows executable.  Instead of appending, the
>stderr output is written to the top of the file, corrupting it. This
>happens only if the 'make' process has its own stdout/err redirected to
>a pipe.
>Example recipe:
>     all:
>             echo first > output
>             echo
>secondxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx >> output
>             /cygdrive/c/Windows/System32/sort.exe nonexist 2>> output; true
>When "make" is run, the "output" file should be:
>     first
>     secondxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
>     nonexistThe system cannot find the file specified.
>and in fact it is.  But when "make 2>&1 | cat" is run, the output is:
>     nonexistThe system cannot find the file specified.
>     xxxxxxxxxxxxxx
>even though it should be the same as before.  The error message written
>by sort.exe went to the top of the file instead of the end.

Just a wild guess here: line endings?  Try 

make 2>&1 | cat -A 

and see if everything's there.


Problem reports:
Unsubscribe info:

More information about the Cygwin mailing list