io.c: pipe_register_fptr

* io.c (pipe_register_fptr): get rid of double registration which
  causes access after free and segfault.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62121 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2018-01-31 04:24:57 +00:00
parent 80d74ea732
commit 1d5847d1af
2 changed files with 25 additions and 4 deletions

View file

@ -1810,6 +1810,15 @@ class TestProcess < Test::Unit::TestCase
end
end
def test_popen_reopen
assert_separately([], "#{<<~"begin;"}\n#{<<~'end;'}")
begin;
io = File.open(IO::NULL)
IO.popen("echo") {|f| io.reopen(f)}
io.reopen(io.dup)
end;
end
def test_execopts_new_pgroup
return unless windows?