Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open3.capture3 still broken in JRuby 1.7.17 #2298

Closed
phrinx opened this issue Dec 10, 2014 · 5 comments
Closed

Open3.capture3 still broken in JRuby 1.7.17 #2298

phrinx opened this issue Dec 10, 2014 · 5 comments
Assignees
Milestone

Comments

@phrinx
Copy link

@phrinx phrinx commented Dec 10, 2014

This one seems related to #1290 which has been closed and is supposed to be fixed in JRuby 1.7.17

|ruby-2.1.1| thq-m-dkoeh01 in /tmp/my_folder
○ → ls
myfile.txt

capture3 in MRI (works):

|ruby-2.1.1| thq-m-dkoeh01 in /tmp/my_folder
○ → irb
ruby: warning: RUBY_HEAP_MIN_SLOTS is obsolete. Use RUBY_GC_HEAP_INIT_SLOTS instead.
2.1.1 :001 > require 'open3'
 => true
2.1.1 :002 > Open3.capture3('pwd')
 => ["/tmp/my_folder\n", "", #<Process::Status: pid 1063 exit 0>]
2.1.1 :003 > Open3.capture3('ls')
 => ["myfile.txt\n", "", #<Process::Status: pid 1064 exit 0>]

capture3 with 1.7.17 (fails):

|jruby-1.7.17| thq-m-dkoeh01 in /tmp/my_folder
○ → irb
jruby-1.7.17 :001 > require 'open3'
 => true
jruby-1.7.17 :002 > Open3.capture3('pwd')
 => ["", "usage: pwd [-L | -P]\n", #<Process::Status: pid=1092,exited(1)>]
jruby-1.7.17 :003 > Open3.capture3('ls')
 => ["", "ls: {}: No such file or directory\n", #<Process::Status: pid=1099,exited(1)>]
@rtyler rtyler added this to the JRuby 1.7.18 milestone Dec 10, 2014
@nadavshatz
Copy link

@nadavshatz nadavshatz commented Dec 10, 2014

😭

@headius
Copy link
Member

@headius headius commented Dec 10, 2014

Grr. Ok, I'll look into this.

@headius
Copy link
Member

@headius headius commented Dec 10, 2014

Confirmed. It appears it's still trying to pass the hash as an argument.

@headius
Copy link
Member

@headius headius commented Dec 10, 2014

Bleh, ok I figured it out. This is a new bug.

capture3 calls into popen3 but passes through options for spawn. Our version of popen3 does not support spawn options, and did not peel them off the argument list, so it passed through.

irb(main):002:0> Open3.capture3('echo')
=> ["{}\n", "", #<Process::Status: pid=46968,exited(0)>]

For 1.7.18 I will peel off the options and warn if they're not empty, and we can look at improving our popen/spawn support in a future version.

FWIW, JRuby 9k (master) runs open3.rb unmodified and supports most spawn options.

@mgomes
Copy link

@mgomes mgomes commented Dec 10, 2014

👍

That's awesome re: JRuby 9k.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
5 participants