On Dec 16, 4:18    󮮮
> Hi,
>
> I would like to obtain the exit code from a child program. But all the
> methods I tried were in vain. Here are two files that i used to test.
>
> C:\> type a.bat
> @echo off
> exit /b 29
>
> C:\> type test.rb
> system('a.bat')
> puts $?
> puts $? >> 8
> exit
>
> C:\>ruby test.rb
> pid 5952 exit 0
> 0
>
> Seems like in Windows, Ruby can never see the number 29 anyway.
>
> Can anyone help me?

When reporting any issue, please include full version of Ruby (ruby -
v) that you're using.

Here an example:

ruby 1.8.6 (2009-08-04 patchlevel 383) [i386-mingw32]

irb(main):001:0> system("echo foo && exit /b 29")
foo
=> false
irb(main):002:0> $?
=> #<Process::Status: pid=2296,exited(29)>

irb(main):001:0> $?
=> #<Process::Status: pid=2180,exited(0)>
irb(main):002:0> system('foo.bat')
=> false
irb(main):003:0> $?
=> #<Process::Status: pid=2860,exited(29)>

The exitstatus is correct, what are you trying to achieve shifting the
Process:Status exitstatus value?

--
Luis Lavena