You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Windows Ruby 3.1 - Open3 #capture2 causes IRB console to become unresponsive #288
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)
$> irbrequire'open3'Open3.capture2('ver')# after this, the IRB console becomes unresponsive
changed the title [-]Open3 #capture2 causes IRB console to become unresponsive on Windows Ruby 3.1[/-][+]Windows Ruby 3.1 - Open3 #capture2 causes IRB console to become unresponsive[/+]on Jun 26, 2022
same is happening to me and it is making nokigiri installation fail
> gem install nokogiri
Temporarily enhancing PATH for MSYS/MINGW...
Building native extensions. This could take a while...
#<Thread:0x0000013ef5ede448 C:/Programming/Ruby/rubyinstaller-3.2.0-1-x64/lib/ruby/3.2.0/open3.rb:404 run> terminated with exception (report_on_exception is true):
C:/Programming/Ruby/rubyinstaller-3.2.0-1-x64/lib/ruby/3.2.0/open3.rb:404:in `read': stream closed in another thread (IOError)
from C:/Programming/Ruby/rubyinstaller-3.2.0-1-x64/lib/ruby/3.2.0/open3.rb:404:in `block (2 levels) in capture2e'
ERROR: Interrupted
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] .
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.
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.
@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 google-apis-core to remove usages of Open3.capture2 each time I install them.
We're hitting this issue too on two different Windows 11 versions Ruby versions:
C:\Users\a>systeminfo
...
OS Name: Microsoft Windows 11 Home
OS Version: 10.0.22000 N/A Build 22000
C:\Users\a>ruby --version
ruby 3.3.3 (2024-06-12 revision f1c7b6f435) [x64-mingw-ucrt]
And:
C:\Users\a>systeminfo
...
OS Name: Microsoft Windows 11 Pro
OS Version: 10.0.22631 N/A Build 22631
PS C:\Users\a\Desktop> ruby --version
ruby 3.1.5p252 (2024-04-23 revision 1945f8dc0e) [x64-mingw-ucrt]
Is there anything I could do to help with debugging this issue? Happy to try and help 👀
But after commenting out the in pipe config option, the issue disappears for me:
require'open3'require'reline'defpopen_bug(cmd)opts={}# Commenting this out causes things to work again:# in_r, in_w = IO.pipe# opts[:in] = in_r# in_w.sync = trueout_r,out_w=IO.pipeopts[[:out,:err]]=out_wpid=spawn(*cmd,opts)wait_thr=Process.detach(pid)wait_thr.valueendpopen_bug("dir")line=Reline.readline('hello > ')
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 hello > and was able to type in the "this is all ok" text and press enter so the script completed.
$ ruby popen.rb
hello > this is all ok
I don't have Windows 11, so I can't check if it's related to that.
Ruby 3.2 is using open3 (default: 0.1.2)
Ruby 3.3 is using open3 (default: 0.2.1)
I'm seeing this issue too. If I run irb --inf-ruby-mode, input is no longer broken after running the minimum repro (but you lose all the nice repl features).
I'm running on Windows 11 within Git Bash For Windows (launched as admin).
This is still a problem on Ruby 3.4.3 on Windows 11. In IRB, doing Open3.capture3('git status') will cause terminal to hang. Interestingly the ▽ character is no longer appearing for me tho.
What version of Ruby, IRB and Reline are you using @johnnyshields ? Are you able to replicate with the latest releases of those gems 👀
I've also cross-posted this as a Reline issue over here ruby/reline#827 just incase a Reline developer happens to have a potential thread to pull on or additional debugging advice
Since the environmental conditions causing this issue are unknown, could anyone who can reproduce the problem please report it to ruby/reline issue ruby/reline#827 ?
Activity
[-]Open3 #capture2 causes IRB console to become unresponsive on Windows Ruby 3.1[/-][+]Windows Ruby 3.1 - Open3 #capture2 causes IRB console to become unresponsive[/+]mohits commentedon Jun 26, 2022
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.
johnnyshields commentedon Jun 26, 2022
@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.
mohits commentedon Jun 26, 2022
@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.
johnnyshields commentedon Jun 26, 2022
@mohits I appreciate it.
MSP-Greg commentedon Jun 26, 2022
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.
P3t3rU5 commentedon Jan 1, 2023
same is happening to me and it is making nokigiri installation fail
ccmywish commentedon Jan 11, 2023
Test report:
gem install nokogirion Windows 11 (10.0.22621.1105) withRuby 3.2.0-1works fine.I think this may relate to some specific Windows versions.
P3t3rU5 commentedon Jan 19, 2023
Seems like MSYS was the issue here - installed on top of my previous installation and it started working
P3t3rU5 commentedon Jan 20, 2023
nevermind... seemed to work but when doing bundler update it gets stuck trying to install nokogiri
johnnyshields commentedon Jan 23, 2023
This issue is still persisting with the officially released Windows RubyInstaller for Ruby 3.2.0
OursCodeur commentedon May 15, 2023
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] .
MSP-Greg commentedon May 15, 2023
Not sure if this is an Open3 issue, as the following work. Might be an irb issue?
OursCodeur commentedon May 15, 2023
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.
johnnyshields commentedon May 15, 2023
OursCodeur commentedon May 16, 2023
Trying to work my way around Open3, I've also been able to reproduce the IRB hang with
systemu('env').johnnyshields commentedon Jun 2, 2024
FYI this issue still happens on Windows Ruby Installer for Ruby 3.3.1
johnnyshields commentedon Aug 6, 2024
@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
google-apis-coreto remove usages ofOpen3.capture2each time I install them.adfoster-r7 commentedon Aug 12, 2024
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 👀
adfoster-r7 commentedon Aug 12, 2024
For context we're hitting the issue outside of irb with reline:
Outcome:
And the terminal hangs; however removing the
Open3call works as expected:Poked a bit further, and it looks like this replicates with some of the lower level building blocks of popen:
Output broken and hanging:
But after commenting out the
inpipe config option, the issue disappears for me:mohits commentedon Oct 12, 2024
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
hello >and was able to type in the "this is all ok" text and press enter so the script completed.I don't have Windows 11, so I can't check if it's related to that.
Ruby 3.2 is using
open3 (default: 0.1.2)Ruby 3.3 is using
open3 (default: 0.2.1)amirrajan commentedon Feb 27, 2025
I'm seeing this issue too. If I run
irb --inf-ruby-mode, input is no longer broken after running the minimum repro (but you lose all the nice repl features).I'm running on Windows 11 within Git Bash For Windows (launched as admin).
amirrajan commentedon Apr 7, 2025
A bit more information that may be pertinent. This issue only seems to be in Windows 11 (Windows 10 looks to work)
johnnyshields commentedon May 17, 2025
This is still a problem on Ruby 3.4.3 on Windows 11. In IRB, doing
Open3.capture3('git status')will cause terminal to hang. Interestingly the▽character is no longer appearing for me tho.adfoster-r7 commentedon May 18, 2025
What version of Ruby, IRB and Reline are you using @johnnyshields ? Are you able to replicate with the latest releases of those gems 👀
I've also cross-posted this as a Reline issue over here ruby/reline#827 just incase a Reline developer happens to have a potential thread to pull on or additional debugging advice
johnnyshields commentedon Aug 1, 2025
@adfoster-r7 I confirmed this still happens on Windows 11 with:
YO4 commentedon Dec 10, 2025
I posted PR ruby/reline#875 to ruby/reline.
Since the environmental conditions causing this issue are unknown, could anyone who can reproduce the problem please report it to ruby/reline issue ruby/reline#827 ?
YO4 commentedon Dec 29, 2025
ruby/reline#875 merged.