1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

open3.rb: Hash.try_convert

* lib/open3.rb (popen_run): use Hash.try_convert for duck typing.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49177 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2015-01-08 03:52:01 +00:00
parent c4675d865a
commit e247d9e145

View file

@ -190,7 +190,10 @@ module Open3
module_function :popen2e
def popen_run(cmd, opts, child_io, parent_io) # :nodoc:
opts = opts.merge(cmd.pop) if cmd.last.kind_of? Hash
if last = Hash.try_convert(cmd.last)
opts = opts.merge(last)
cmd.pop
end
pid = spawn(*cmd, opts)
wait_thr = Process.detach(pid)
child_io.each {|io| io.close }