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.popen2e and Open3.popen2 do not behave as expected #1045

Closed
Seanny123 opened this issue Sep 30, 2013 · 5 comments
Closed

Open3.popen2e and Open3.popen2 do not behave as expected #1045

Seanny123 opened this issue Sep 30, 2013 · 5 comments

Comments

@Seanny123
Copy link

I can successfully open a pipe with the following code in Ruby 1.9.3:

require "open3"
ain, aout, wait = Open3.popen2e("echo 'hello'")

But when I run the same code with JRuby 1.7.4, I get the following result:

require "open3"
ain, aout, wait = Open3.popen2e("echo 'hello'")
file:/home/user/.rvm/rubies/jruby-1.7.4/lib/jruby.jar!/jruby/kernel19/process.rb:4 warning: unsupported spawn option: in
TypeError: wrong exec option: [:out, :err]
from org/jruby/RubyProcess.java:1067:in `_spawn_internal'

Open3.popen2 also give a weird result, that is not necessarily a bug, but might give you a better idea might be going wrong:

require "open3"
ain, aout, wait = Open3.popen2("echo 'hello'")
file:/home/user/.rvm/rubies/jruby-1.7.4/lib/jruby.jar!/jruby/kernel19/process.rb:4 warning: unsupported spawn option: in
file:/home/user/.rvm/rubies/jruby-1.7.4/lib/jruby.jar!/jruby/kernel19/process.rb:4 warning: unsupported spawn option: out

However Open3.popen3 does work as expected. My OS is Ubuntu 12.04.

@nilbus
Copy link
Contributor

nilbus commented Jan 25, 2014

This seems related: http://jira.codehaus.org/browse/JRUBY-5710
However it has been closed in favor of http://jira.codehaus.org/browse/JRUBY-6195
which is indirectly related.

@headius
Copy link
Member

headius commented Mar 6, 2015

This should work just fine on JRuby 9k, which has a new truly-native spawn. For JRuby 1.7, it may just require hacking our modified open3.rb to support another form of popen3, which does work. I'll have a look.

@ripienaar
Copy link

I tested this on 9k and it works for me

Open3.popen2e("test.sh") do |stdin, out, wait_thr|
  stdin.close

  puts out.gets until out.eof?
end

does what you'd expect

@headius
Copy link
Member

headius commented May 8, 2015

@ripienaar Thanks for the confirmation.

More work is needed here to get open2e and the other forms to work right.

@enebo enebo added this to the Won't Fix milestone Feb 17, 2017
@enebo
Copy link
Member

enebo commented Feb 17, 2017

This works in 9k and we will never fix this in 1.7.x as it is winding down....resolving.

@enebo enebo closed this as completed Feb 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants