Issue #7358 has been updated by usa (Usaku NAKAMURA).

Status changed from Assigned to Rejected

1.9.3 is out of date

----------------------------------------
Backport #7358: Wrong fd redirection on fork
https://bugs.ruby-lang.org/issues/7358#change-67435

* Author: felipec (Felipe Contreras)
* Status: Rejected
* Priority: Normal
* Assignee: usa (Usaku NAKAMURA)
----------------------------------------
It seems fd redirecton only works with spawn, not with fork+exec (at least for fd 3).

% ruby -v
ruby 1.9.3p327 (2012-11-10 revision 37606) [x86_64-linux]

#!/usr/bin/env ruby

tmp = File.new('/tmp/foo', File::CREAT | File::WRONLY)
cmd = ['echo', 'yes']

pid = Process.spawn(*cmd, 3 => tmp)
Process.wait(pid)

pid = fork do
  Process.exec(*cmd, :close_others => true, 3 => tmp)
end
Process.wait(pid)



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>