ruby-changes:37092
From: akr <ko1@a...>
Date: Thu, 8 Jan 2015 00:29:41 +0900 (JST)
Subject: [ruby-changes:37092] akr:r49173 (trunk): * lib/open3.rb: Open3 properly passes non-keyword hash args to spawn.
akr 2015-01-08 00:29:28 +0900 (Thu, 08 Jan 2015) New Revision: 49173 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49173 Log: * lib/open3.rb: Open3 properly passes non-keyword hash args to spawn. Fixed by Josh Cheek. [Fix GH-808] Related to [ruby-core:67347] [Bug #10699] Modified files: trunk/ChangeLog trunk/lib/open3.rb trunk/test/test_open3.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 49172) +++ ChangeLog (revision 49173) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Thu Jan 8 00:13:52 2015 Tanaka Akira <akr@f...> + + * lib/open3.rb: Open3 properly passes non-keyword hash args to spawn. + Fixed by Josh Cheek. [Fix GH-808] + Related to [ruby-core:67347] [Bug #10699] + Wed Jan 7 19:19:26 2015 Nobuyoshi Nakada <nobu@r...> * dir.c (dir_initialize): workaround of opendir failure at symlink Index: lib/open3.rb =================================================================== --- lib/open3.rb (revision 49172) +++ lib/open3.rb (revision 49173) @@ -190,6 +190,7 @@ module Open3 https://github.com/ruby/ruby/blob/trunk/lib/open3.rb#L190 module_function :popen2e def popen_run(cmd, opts, child_io, parent_io) # :nodoc: + opts = opts.merge(cmd.pop) if cmd.last.kind_of? Hash pid = spawn(*cmd, opts) wait_thr = Process.detach(pid) child_io.each {|io| io.close } Index: test/test_open3.rb =================================================================== --- test/test_open3.rb (revision 49172) +++ test/test_open3.rb (revision 49173) @@ -80,6 +80,14 @@ class TestOpen3 < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/test_open3.rb#L80 end end + def test_numeric_file_descriptors + with_pipe { |r, w| + Open3.popen3(RUBY, '-e', 'IO.open(3).puts "foo"', 3 => w) {|i,o,e,t| + assert_equal("foo\n", r.gets, "[GH-808] [ruby-core:67347] [Bug #10699]") + } + } + end + def with_pipe r, w = IO.pipe yield r, w -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/