From: Anthony Wright Date: 2011-02-03T01:49:33+09:00 Subject: Bug in system()? I've just hit a problem where the system() method to call an external program failed in a fairly unpredictable way, and I couldn't get any clues from within ruby to diagnose the problem, so I ended up debugging process.c to work out what the problem was. My code looks something like: system("/bin/tar --extract --directory=#{dir} --file=#{file}") if $?.exitstatus !=0 raise "tar unpack failed with exitstatus: #{$?.exitstatus}" end But it fails on the if because '$?' isn't being set by the failing system() method and so '$?' is nil. The problem ultimately boiled down to the fork() system call failing with ENOMEM (badly configured system, but that's another matter). Am I missing something here? Should there be a way to get errno from ruby, or am I missing other diagnostic information I could have used? Is there a bug in system()? Shouldn't it always set '$?' ? thanks, Anthony Wright