diff --git a/ChangeLog b/ChangeLog index da8fdd7929..1e97322cb1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Thu Jan 8 00:13:52 2015 Tanaka Akira + + * 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 * dir.c (dir_initialize): workaround of opendir failure at symlink diff --git a/lib/open3.rb b/lib/open3.rb index 6ec4a941d2..959181b67d 100644 --- a/lib/open3.rb +++ b/lib/open3.rb @@ -190,6 +190,7 @@ 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 pid = spawn(*cmd, opts) wait_thr = Process.detach(pid) child_io.each {|io| io.close } diff --git a/test/test_open3.rb b/test/test_open3.rb index e560fbedb4..a268822bed 100644 --- a/test/test_open3.rb +++ b/test/test_open3.rb @@ -80,6 +80,14 @@ class TestOpen3 < Test::Unit::TestCase 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