-
Notifications
You must be signed in to change notification settings - Fork 254
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
Windows Ruby 3.1 - Open3 #capture2 causes IRB console to become unresponsive #288
Comments
Hi @johnnyshields - I did a quick check with your sample on my side, and it seems to work as expected. This is in the Windows console (cmd).
Just adding this here in case it helps to debug what the difference might be. |
@mohits thanks for checking this, this is very useful. Hmmm very strange. Possibly something specific to my system. Quite bizarre tho as Ruby 3.0 and earlier don't have the same issue. |
@johnnyshields - I checked both Ruby 3.0 and Ruby 3.1 on my system (though I only posted the result from 3.1) and both worked fine. The installation is also bog-standard - https://notepad.onghu.com/2022/ruby3.1-windows-day0-install-hello_world/ - nothing special in it. |
@mohits I appreciate it. |
Testing with Ruby 3.1.2 and Ruby master (ruby 3.2.0dev (2022-06-26T02:16:11Z master a782d76fbe) [x64-mingw-ucrt]), I have the same result. |
same is happening to me and it is making nokigiri installation fail
|
Test report: I think this may relate to some specific Windows versions. |
Seems like MSYS was the issue here - installed on top of my previous installation and it started working |
nevermind... seemed to work but when doing bundler update it gets stuck trying to install nokogiri |
This issue is still persisting with the officially released Windows RubyInstaller for Ruby 3.2.0 |
Hey, I can confirm I have the issue as well here - Windows 11 [Version 10.0.22621.1702] and ruby 3.2.2 (2023-03-30 revision e51014f9c0) [x64-mingw-ucrt] . |
Not sure if this is an Open3 issue, as the following work. Might be an irb issue?
|
What started the investigation on my side was using mjml-rails in a regular project on Windows - which relies on Open3 to run MJML itself (here). Capture3 causes ruby to hang up indefinitely, which I can reproduce in irb. I can also confirm @MSP-Greg 's commands do not cause the issue. Hope the additional context helps somehow. |
Technically speaking IRB does not “crash” either, but its state is altered
so that it no longer accepts inputs.
So the fact that the ruby -e commands don’t crash maybe doesn’t tell us a
whole lot.
|
Trying to work my way around Open3, I've also been able to reproduce the IRB hang with |
FYI this issue still happens on Windows Ruby Installer for Ruby 3.3.1 |
@MSP-Greg @larskanis FYI this issue remains on my "Windows Ruby Unsolved Mysteries" list. It would be great if we could try to figure it out, at the moment I have to edit gems like |
We're hitting this issue too on two different Windows 11 versions Ruby versions:
And:
Is there anything I could do to help with debugging this issue? Happy to try and help 👀 |
For context we're hitting the issue outside of irb with reline: require 'open3'
require 'reline'
Open3.capture3('git status')
line = Reline.readline('hello > ') Outcome:
And the terminal hangs; however removing the
Poked a bit further, and it looks like this replicates with some of the lower level building blocks of popen: require 'open3'
require 'reline'
def popen_bug(cmd)
opts = {}
in_r, in_w = IO.pipe
opts[:in] = in_r
in_w.sync = true
out_r, out_w = IO.pipe
opts[[:out, :err]] = out_w
pid = spawn(*cmd, opts)
wait_thr = Process.detach(pid)
wait_thr.value
end
popen_bug("dir")
line = Reline.readline('hello > ') Output broken and hanging:
But after commenting out the require 'open3'
require 'reline'
def popen_bug(cmd)
opts = {}
# Commenting this out causes things to work again:
# in_r, in_w = IO.pipe
# opts[:in] = in_r
# in_w.sync = true
out_r, out_w = IO.pipe
opts[[:out, :err]] = out_w
pid = spawn(*cmd, opts)
wait_thr = Process.detach(pid)
wait_thr.value
end
popen_bug("dir")
line = Reline.readline('hello > ') |
hi @adfoster-r7 - this is strange. On Windows 10, using cmd, I was able to run the script that you had a problem with (including in_r) and on both Ruby 3.2-x64 and Ruby 3.3-x64, I did not have any issue. I got
I don't have Windows 11, so I can't check if it's related to that. Ruby 3.2 is using |
I have also filed a ticket with ruby/open3 repo here: ruby/open3#9, but this seems more like a Windows-specific issue as it works on Linux/Mac.
The following script will cause IRB console to become unresponsive on Ruby 3.1 on Windows installed by the Windows Ruby Installer
x64-mingw-ucrt
. This is using the version of Open3 packaged with Ruby (0.1.1
)The text was updated successfully, but these errors were encountered: