Return codes over 1 byte

Michael DePaulo mikedep333@gmail.com
Thu Jul 9 23:30:00 GMT 2015


mark06 mentioned this on IRC today and then left the channel about 1 hour later:

<mark06> has anyone ever discussed exit codes above one byte? they are
valid on modern windows, but cygwin's bash will mess them

I was curious, so I googled it (I could not find an answer) and then
tried it out. I can confirm the what he said.

Cygwin Bash:

mike@executor ~
$ uname -a
CYGWIN_NT-10.0 executor 2.0.4(0.287/5/3) 2015-06-09 12:22 x86_64 Cygwin

mike@executor ~
$ cat return.c
int main (){ return 512; }

mike@executor ~
$ x86_64-w64-mingw32-gcc return.c -o return.exe

mike@executor ~
$ ./return.exe

mike@executor ~
$ echo $?
0

cmd.exe:

C:\cygwin64\home\mike>return.exe

C:\cygwin64\home\mike>echo %errorlevel%
512

-Mike

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple



More information about the Cygwin mailing list