-
-
Notifications
You must be signed in to change notification settings - Fork 925
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
JRuby 1.7.8 (1.9) Open3 capture3
bug
#1290
Comments
+1. I just ran into this with a gem I'm working on. In my case, I can handle the extra argument to work around it, but if I was trying to run a program that couldn't handle it, I'm not sure what I'd do. |
This gets the acceptance tests passing on JRuby, which has a bug in Open3.capture3. See jruby/jruby#1290 for details.
+1 Just hit this bug, which just makes this method completely useless. Please fix asap. Thank you. |
This bug makes Additional example, if one is needed: #!/usr/bin/env ruby
require 'open3'
def run_test *args
puts "------\n- args: `#{args.inspect}`"
begin
o, e, s = Open3.capture3(*args)
puts "- stdout:"
puts o
puts "- stderr:"
puts e
puts "- status: #{s.exitstatus}"
rescue Exception => e
puts e.inspect
end
end
puts ::RUBY_DESCRIPTION
# from the test/mri/test_open3.rb, which passes
run_test "ruby", '-e', 'i=STDIN.read; print i+"o"; STDOUT.flush; STDERR.print i+"e"', :stdin_data=>"i"
# but you can see that additional args are being included in the executed command ...
run_test "cat", "-n", :stdin_data => "asdf\nqwer\nzxcv\n" On MRI outputs:
On JRuby outputs:
(you'll notice that there is an additional argument of |
+1 |
+1 for this. This bug makes JRuby unable to run the latest mini_magick (minimagick/minimagick#254). |
+1, painful |
Fixed for 1.7.17. I will add a test to MRI, since open3 is no longer part of RubySpec proper and we don't run the rubysl specs. |
Thanks so much, @headius. |
MRI manages the frame's self differently, just saving it into the binding and then putting it in the sole global state field that represents the current thread's active frame. In our case, we use the entire Frame object as a carrier for frame data, so we need to keep the object the same for mutable frame fields like backref to propagate. As a result, the only fix possible for this on 1.7 is to change the self back after instance_eval. We may be able to fix this better on master, where the runtime has been restructured and may support a more correct notion of the current frame's self.
Yay @headius ! |
The newest version of JRuby fixes the old issue where
popen3
would not pass a status object to the block, which is awesome. Unfortunately, while this makescapture3
run, it is not quite correct:As you will observe, the output includes a stringified hash, which is the "options" part of handling the thing. It seems like your
IO::popen3
implementation should either handle those appropriately, or you should move the "RUBY_ENGINE" part down below the "if Hash === cmd.last" part to handle (by ignoring) the options passed. :)Another option, perhaps better, might be to go down and implement
popen_run
instead ofpopen3
, which is invoked by the rest of the methods to handle the actual I/O process.The text was updated successfully, but these errors were encountered: