From: Eric Wong Date: 2014-10-10T18:47:28+00:00 Subject: [ruby-core:65598] Re: [ruby-trunk - Bug #10362] [Open] spawn doesn't raise exception on redirection error bdimych@narod.ru wrote: > irb(main):013:0* system 'cmd', '/c', 'echo', 'aaa', :out => File.open('bad/file.txt', 'w') > Errno::ENOENT: No such file or directory - bad/file.txt > from (irb):13:in `initialize' > from (irb):13:in `open' > from (irb):13 > from C:/Ruby200/bin/irb:12:in `
' > > exception is much more descriptive than just nil Right, but I think the `system' method is intended to hide errors by default. $? must be checked when `system' returns nil: if system('non-existent-command').nil? $? => # end I think it is in the spec for `system' to behave like this.