------art_15378_30688288.1211135191432
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Hello Ruby hackers,

While working on One-Click Installer, Gordon Thiesfeld spotted a
problem in ruby when using Rake:

(in C:/Documents and Settings/gthiesfeld/Desktop)
not gem list
rake aborted!
undefined method `exitstatus' for nil:NilClass
C:/Documents and Settings/gthiesfeld/Desktop/rakefile:6
(See full trace by running task with --trace)

Is is quite common to see that under Windows for commands that doesn't
exist, but on Linux, we got this:

luislavena@cubity/data/_sandbox $ rake gems
(in /data/_sandbox)
not gem list
rake aborted!
Command failed with status (127): [not gem list...]
/data/_sandbox/rakefile:3

Tracing the problem, Rake leverage it's checking into system() result
and $? being set properly.

After debuging process.c, we found the problem was that, on failure,
the status was never set for _WIN32 platform, and thus, returning nil
the first failed system() call and keep reporting the same
Process::Status information of a successfully one:

irb(main):001:0> $?
nil
irb(main):002:0> system('not')
false
irb(main):003:0> $?
nil
irb(main):004:0> system('ruby -v')
ruby 1.8.6 (2008-03-03 patchlevel 114) [i386-mswin32]
true
irb(main):005:0> $?
#<Process::Status: pid020,exited(0)>
irb(main):006:0> system('not')
false
irb(main):007:0> $?
#<Process::Status: pid020,exited(0)>

(both mingw and mswin was reporting the same).

The attached patch applies into ruby_1_8 branch and solve this issue:

irb(main):001:0> $?
nil
irb(main):002:0> system('not')
false
irb(main):003:0> $?
#<Process::Status: pidexited(127)>
irb(main):004:0> system('ruby -v')
ruby 1.8.6 (2008-03-03 patchlevel 114) [i386-mingw32]
true
irb(main):005:0> $?
#<Process::Status: pid252,exited(0)>
irb(main):006:0> system('not')
false
irb(main):007:0> $?
#<Process::Status: pidexited(127)>

Looking forward for this being applied.

Regards,
-- 
Luis Lavena
AREA 17
-
Human beings, who are almost unique in having the ability to learn from
the experience of others, are also remarkable for their apparent
disinclination to do so.
Douglas Adams

------art_15378_30688288.1211135191432
Content-Type: text/x-patch; name=ruby_1_8-process-set-status.patch
Content-Transfer-Encoding: base64
X-Attachment-Id: f_fgdy5vwv0
Content-Disposition: attachment; filename=ruby_1_8-process-set-status.patch

SW5kZXg6IHByb2Nlc3MuYw0KPT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09
PT09PT09PT09PT09PT09PT09PT09PT09PT09PQ0KLS0tIHByb2Nlc3MuYwkocmV2aXNpb24gMTY0
NTgpDQorKysgcHJvY2Vzcy5jCSh3b3JraW5nIGNvcHkpDQpAQCAtMTUxOSw2ICsxNTE5LDEwIEBA
DQogICAgIH0KICNpZiAhZGVmaW5lZChfV0lOMzIpCiAgICAgbGFzdF9zdGF0dXNfc2V0KHN0YXR1
cyA9PSAtMSA/IDEyNyA6IHN0YXR1cywgMCk7CisjZWxzZQorICAgIGlmIChzdGF0dXMgPT0gLTEp
IHsKKyAgICAgICAgbGFzdF9zdGF0dXNfc2V0KDB4N2YgPDwgOCwgMCk7CisgICAgfQogI2VuZGlm
CiAjZWxpZiBkZWZpbmVkKF9fVk1TKQogICAgIFZBTFVFIGNtZDsK
------art_15378_30688288.1211135191432--