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

Comments

Projects
None yet
5 participants
@phrinx
Copy link

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 the JRuby 1.7.x label Dec 10, 2014

@rtyler rtyler added this to the JRuby 1.7.18 milestone Dec 10, 2014

@nadavshatz

This comment has been minimized.

Copy link

nadavshatz commented Dec 10, 2014

😭

@headius

This comment has been minimized.

Copy link
Member

headius commented Dec 10, 2014

Grr. Ok, I'll look into this.

@headius

This comment has been minimized.

Copy link
Member

headius commented Dec 10, 2014

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

@headius

This comment has been minimized.

Copy link
Member

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

This comment has been minimized.

Copy link

mgomes commented Dec 10, 2014

👍

That's awesome re: JRuby 9k.

headius added a commit that referenced this issue Dec 10, 2014

@headius headius closed this Dec 10, 2014

@headius headius self-assigned this Dec 10, 2014

@headius headius added the core label Dec 10, 2014

philr added a commit to philr/bzip2-ffi that referenced this issue Jan 4, 2015

Use jruby-1.7.18.
Fixes a bug with capture3 (jruby/jruby#2298).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.