summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--lib/open3.rb1
-rw-r--r--test/test_open3.rb8
3 files changed, 15 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index da8fdd7..1e97322 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Thu Jan 8 00:13:52 2015 Tanaka Akira <akr@fsij.org>
+
+ * 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@ruby-lang.org>
* dir.c (dir_initialize): workaround of opendir failure at symlink
diff --git a/lib/open3.rb b/lib/open3.rb
index 6ec4a94..959181b 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 e560fbe..a268822 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