From: KOSAKI Motohiro Date: 2012-06-08T16:26:09+09:00 Subject: [ruby-core:45502] Re: [ruby-trunk - Feature #2715] Optimization to avoid spawning shell in Kernel#system call should check for failure conditions On Fri, Jun 8, 2012 at 3:21 AM, akr (Akira Tanaka) wrote: > > Issue #2715 has been updated by akr (Akira Tanaka). > > >> .... I realized IO.pid is crazy mistaken feature. It wouldn't work when using complex cmdline even if we will not remove the optimization. Sigh. (+_+ > > Killing a complex command line, which invokes many processes, is a different problem. > IO#pid is not a origin of the problem. > spawn also have same problem as follows. > > �pid = spawn("foo & bar"); Process.kill(:TERM, pid) > > Do you say that returning pid feature of spawn is crazy mistaken? > > Killing a complex command line needs process group, > as shell job control does. > > To return to this issue, I'm considering adding a new spawn option, :shell. > This option disables the optimization. > > �system("simple command", :shell=>true) > > The default of the option is disabled as now. > > This option solves this issue as: > - shell error messages are printed if :shell => true. > - doesn't break programs which expects simple commands are direct child process. > - don't need to implement mimic of shell error message printing feature in ruby. Seems make sense.