rtomayko / posix-spawn

Ruby process spawning library
Other
519 stars 52 forks source link

POSIX::Spawn.system wrong return values and stale $? for missing commands #81

Open felixbuenemann opened 7 years ago

felixbuenemann commented 7 years ago

The MRI Kernel.system method returns nil if the command could not be found, but POSIX::Spawn.system returns false.

Simple test:

puts Kernel.system("foo").inspect
puts POSIX::Spawn.system("foo").inspect

Output:

nil
false

Looking at the source this should be a one-line fix.

rtomayko commented 7 years ago

@felixbuenemann Sounds good to me. Thanks for your research here.

felixbuenemann commented 7 years ago

@rtomayko I've removed all my comments regarding $? and created a separate issue #82, so it would be great if you could do the same to avoid confusion.