Close dup'ed fd after using

This commit is contained in:
Dmitry Vorotilin 2014-08-27 04:01:31 +04:00
parent 9387c8919a
commit b0612f790d
2 changed files with 2 additions and 1 deletions

View File

@ -17,6 +17,7 @@
(Adam Prescott) [Issue #493]
* Ensure process exits with correct status code and $! is propagated.
(Micah Geisel) [Issue #497]
* Close dup'ed fd after using (Dmitry Vorotilin) [Issue #446, #529, #528]
### 1.5.0 ###

View File

@ -99,13 +99,13 @@ module Capybara::Poltergeist
# it works with JRuby but I've experienced strange mistakes on Rubinius.
def redirect_stdout
prev = STDOUT.dup
prev.autoclose = false
$stdout = @write_io
STDOUT.reopen(@write_io)
yield
ensure
STDOUT.reopen(prev)
$stdout = STDOUT
prev.close
end
def kill_phantomjs