summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-01-08 03:52:01 (GMT)
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-01-08 03:52:01 (GMT)
commite247d9e1456c9c1487bcc0190b8b501bf1a013c8 (patch)
treeb34f5635d9efc6086098164c824968326045063d /lib
parentc4675d865a9d555ab1648e81a891df9e344e4ae0 (diff)
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
Diffstat (limited to 'lib')
-rw-r--r--lib/open3.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/open3.rb b/lib/open3.rb
index 959181b..5824510 100644
--- a/lib/open3.rb
+++ b/lib/open3.rb
@@ -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 }