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.popen3 with block fails on Windows #3948

Closed
elcubo opened this issue Jun 1, 2016 · 6 comments
Closed

Open3.popen3 with block fails on Windows #3948

elcubo opened this issue Jun 1, 2016 · 6 comments

Comments

@elcubo
Copy link
Contributor

elcubo commented Jun 1, 2016

Environment

Windows 7, 64 bit
Jruby 9.1.2.0
Java 1.8.0_91-b14

Expected Behavior

Running the following program

require 'open3'

Open3.popen3("c:/Windows/System32/whoami.exe", "/?") { |i, o, e| }

This should complete without exception.

Actual Behavior

The program fails with an exception:

NotImplementedError: waitpid unsupported or native support failed to load; see http://wiki.jruby.org/Native-Libraries
@elcubo
Copy link
Contributor Author

elcubo commented Jun 1, 2016

Ran jruby -Xnative.verbose=true open3_test.rb and it returned Successfully loaded native POSIX impl.

@donv
Copy link
Member

donv commented Jun 6, 2016

@elcubo could you test with JRuby 1.7.25?

@elcubo
Copy link
Contributor Author

elcubo commented Jun 7, 2016

I've run my cute little test program on JRuby v1.7.13, and it worked perfectly.

Another thing I should mention is that when running on v9.1.2.0, the parameters to the program being called are getting mixed up somehow. I'm not quite sure how, but the output from the command (whoami.exe) is

ERROR: Invalid argument/option - '{:in=>#<IO:fd 936>, :out=>#<IO:fd 1076>, :err=>#<IO:fd 1084>}'.

I don't know if it is related, but my guess is, it is.

@headius
Copy link
Member

headius commented Aug 15, 2016

This is likely because we updated open3.rb to match MRI's version, which depends on spawn working properly. Our spawn implementation in Windows is still a bit lacking.

In the short term, we could restore the old open3.rb logic on windows, which should be as good as 1.7 at least. The longer term fix would be to get the proper spawn logic into JRuby.

@headius
Copy link
Member

headius commented Aug 15, 2016

Ok, so the Windows logic was moved off to the side in f417f92 and then the short-circuited load in open3.rb was lost again in 66570f0.

I'm restoring the short-circuit logic, which should get us back to at least 1.7.25 level.

@elcubo
Copy link
Contributor Author

elcubo commented Aug 16, 2016

Verified on nightly build. Thanks! 😎

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

3 participants