Skip to content

Commit

Permalink
[fix #104] update open3 library with CRuby 1.9
Browse files Browse the repository at this point in the history
  • Loading branch information
Watson1978 committed Jun 20, 2012
1 parent 2dbde57 commit 2ad819e
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/open3.rb
Expand Up @@ -203,11 +203,13 @@ def popen_run(cmd, opts, child_io, parent_io) # :nodoc:
wait_thr = Process.detach(pid)
child_io.each {|io| io.close }
result = [*parent_io, wait_thr]
begin
return yield(*result)
ensure
parent_io.each{|io| io.close unless io.closed?}
wait_thr.join if wait_thr
if defined? yield
begin
return yield(*result)
ensure
parent_io.each{|io| io.close unless io.closed?}
wait_thr.join
end
end
result
end
Expand Down

0 comments on commit 2ad819e

Please sign in to comment.