Skip to content

Commit

Permalink
protected redirected fds from CLOEXEC in fspawn
Browse files Browse the repository at this point in the history
  • Loading branch information
Patrick Reynolds committed Jun 30, 2014
1 parent 6146290 commit ebb24b2
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/posix/spawn.rb
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,8 @@ def fspawn(*args)
if fd?(val)
val = fd_to_io(val)
key.reopen(val)
key.close_on_exec = false
val.close_on_exec = false
elsif val == :close
if key.respond_to?(:close_on_exec=)
key.close_on_exec = true
Expand All @@ -236,7 +238,7 @@ def fspawn(*args)
Process::setpgid(0, pgroup) if pgroup

# do the deed
::Kernel::exec(*argv)
::Kernel::exec(*argv, :close_others=>false)
ensure
exit!(127)
end
Expand Down

0 comments on commit ebb24b2

Please sign in to comment.