Issue #8083 has been updated by phasis68 (Heesob Park).


According to the document http://en.wikipedia.org/wiki/Exit_status#Windows,
"Windows uses 32-bit signed integers as exit codes. If a process fails initialization, a Windows system error code may be returned. Windows system error codes are available online.
Exit codes are directly referenced, for example, by the command line interpreter CMD.exe in the errorlevel terminology inherited from DOS. .NET Framework processes and the Windows PowerShell refer to it as the ExitCode property of the Process object."

Refer to 
http://stackoverflow.com/questions/179565/exitcodes-bigger-than-255-possible
http://www.hiteksoftware.com/mize/Knowledge/articles/049.htm

----------------------------------------
Bug #8083: Exit status is limited to one-byte values which is invalid for Windows
https://bugs.ruby-lang.org/issues/8083#change-37589

Author: rutsky (Vladimir Rutsky)
Status: Feedback
Priority: Normal
Assignee: cruby-windows
Category: platform/windows
Target version: 
ruby -v: ruby 1.9.3p0 (2011-10-30) [i386-mingw32]


=begin
Windows uses 32-bit process exit codes so Ruby incorrectly truncates them to one byte:

 C:\Ruby193\bin>ruby -e "system('C:\windows\system32\cmd.exe /c exit 255'); puts $?.exitstatus"
 255

 C:\Ruby193\bin>ruby -e "system('C:\windows\system32\cmd.exe /c exit 256'); puts $?.exitstatus"
 0

 C:\Ruby193\bin>ruby -e "system('C:\windows\system32\cmd.exe /c exit 257'); puts $?.exitstatus"
 1


Similar code works correctly in Python:

 C:\Python27>python -c "import subprocess; print subprocess.call('C:\windows\system32\cmd.exe /c exit 255')"
 255

 C:\Python27>python -c "import subprocess; print subprocess.call('C:\windows\system32\cmd.exe /c exit 256')"
 256

 C:\Python27>python -c "import subprocess; print subprocess.call('C:\windows\system32\cmd.exe /c exit 257')"
 257
=end



-- 
http://bugs.ruby-lang.org/