From: Tanaka Akira Date: 2010-02-06T12:07:56+09:00 Subject: [ruby-core:28076] Re: [Bug #2715] Optimization to avoid spawning shell in Kernel#system call should check for failure conditions 2010/2/6 Nobuyoshi Nakada : > What's that you want to do? In 1.9, the former returns nil, > while the later returns false, and spawn and Process.spawn > raise an Errno::ENOENT. I guess he want to print the error message. I think it is sane request. In 1.9, this may be implemented as follows. def system_with_error_message(str) if system(str) == nil command = str[/\S+/] STDERR.puts "#{command}: command not found" end end system_with_error_message("fail") system_with_error_message("fail;") However, we should not need such conditional because the shell avoidance is an optimization. We should not need to know optimizations in general. > # run "fail" command with no output > system("fail", out:"/dev/null", err:[:child, :out]) Shorter version: system("fail", [:out, :err]=>"/dev/null") -- Tanaka Akira