diff --git a/lib/open3.rb b/lib/open3.rb index 959181b67d..58245100b4 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 }