Open3.popen3 with block fails on Windows #3948

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

Comments

Projects
None yet
3 participants
@elcubo
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

This comment has been minimized.

Show comment
Hide comment
@elcubo

elcubo Jun 1, 2016

Contributor

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

Contributor

elcubo commented Jun 1, 2016

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

@elcubo elcubo referenced this issue in yaauie/cliver Jun 1, 2016

Closed

Cannot find phantomjs.exe on Windows #19

@donv donv added the JRuby 9000 label Jun 6, 2016

@donv donv added this to the JRuby 9.1.3.0 milestone Jun 6, 2016

@donv donv added the stdlib label Jun 6, 2016

@donv

This comment has been minimized.

Show comment
Hide comment
@donv

donv Jun 6, 2016

Member

@elcubo could you test with JRuby 1.7.25?

Member

donv commented Jun 6, 2016

@elcubo could you test with JRuby 1.7.25?

@elcubo

This comment has been minimized.

Show comment
Hide comment
@elcubo

elcubo Jun 7, 2016

Contributor

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.

Contributor

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

This comment has been minimized.

Show comment
Hide comment
@headius

headius Aug 15, 2016

Member

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.

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

This comment has been minimized.

Show comment
Hide comment
@headius

headius Aug 15, 2016

Member

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.

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

This comment has been minimized.

Show comment
Hide comment
@elcubo

elcubo Aug 16, 2016

Contributor

Verified on nightly build. Thanks! 😎

Contributor

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