Skip to content

Passing environment hash to Open3#popen3 causes IOError #1547

@rabbitt

Description

@rabbitt

Test Code

require 'open3'
require 'pp'

ENV.keys.collect { |k| ENV.delete(k) }
result = Open3.popen3({'A' => 'B', 'C' => 'D'}, '/usr/bin/env') do |i, out, err, thr|
  output = Thread.new { out.read }
  error  = Thread.new { err.read }

  [ output.value, error.value, thr.value ]
end

pp result

Expected Results (based on tests with MRI 1.9.3, 2.0.0 and 2.1.1):

["A=B\nC=D\n", "", #<Process::Status: pid 46225 exit 0>]

Actual results (same with both jruby 1.7.10 and 1.7.11):

IOError: Cannot run program "{"A"=>"B", "C"=>"D"}" (in directory "/Users/rabbitt/personal/repos/git-hooks"): error=2, No such file or directory
  popen3 at org/jruby/RubyIO.java:4375
  popen3 at /Users/rabbitt/.rvm/rubies/jruby-1.7.11/lib/ruby/1.9/open3.rb:74
  (root) at test.rb:5

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions