Comments (10)
Fow now, I've forwarded to ruby for Reline behavior: https://bugs.ruby-lang.org/issues/20052
from aruba.
As a workaround, adding gem 'readline-ext'
like rails/rails might solve this. rails/rails#48183
require 'readline'
tries to require real readline and fallbacks to reline in both ruby 3.2 and 3.3.
Ruby 3.3 does not bundle readline-ext anymore.
from aruba.
ruby3.3 is going to be released within one month. Can you enable ruby3.3 on github CI and debug this issue?
from aruba.
Hi @mtasaka thanks for the reminder. I'll look into it.
from aruba.
I have debugged this issue and the source of the difference is that require "readline"
loads Reline in Ruby 3.3, and 'real' Readline in Ruby 3.2.
Reline behaves oddly when output is not a tty. This can be demonstrated without pry
and without using Ruby 3.3 by running irb
piping to tee
:
$ irb | tee irb.log
irb(main):001> foo = 1
irb(main):001> firb(main):001> foirb(main):001> fooirb(main):001> foo irb(main):001> foo =irb(main):001> foo = irb(main):001> foo = 1=> 1
irb(main):002> foo
irb(main):002> firb(main):002> foirb(main):002> foo=> 1
irb(main):003> exit
irb(main):003> eirb(main):003> exirb(main):003> exiirb(main):003> exit %
Or even simpler:
$ echo 'foo' | ruby -e 'require "reline"; puts Reline.readline(">")' | tee bar.log
>>>f>f>fo>fo>foo>foofoo
from aruba.
Summarizing, this issue with Reline affects the test suite because
pry
uses Reline by default with Ruby 3.3pry
uses a non-empty prompt- Reline has the issue described above when output is not a tty
- Aruba's SpawnProcess creates an output stream for the process that is not a tty
Options for Aruba are:
- Change the test suite to use
irb
. For some reason (not yet clear to me),irb
won't show any prompt when run this way, which means this problem doesn't occur - Change Aruba's
SpawnProcess
runner so the spawned process is a tty. I've looked into this andPTY.open
might play a role in this but I don't yet see a solution that doesn't involve manually reading from the resulting output, which we now avoid by just passing an open file handle pointing to an open Tempfile. - Wait for the Reline bug (?) to be fixed. I'm not keen on this option because Aruba should be ready to test with Ruby 3.3 as soon as it's released
I lean toward the first option, which means
- Updating the test suite
- Documenting that Aruba will run processes under test with output that is not a tty
- Opening a new ticket to add a feature to make the output streams ttys, either optionally or always
from aruba.
Thanks @tompng. I looked that pull request and its comments and another work-around was merged later, which uses Reline but sets TERM=dumb
: rails/rails#48369. I will try and see if that works for Aruba as well.
from aruba.
Some other workaround I found is to
Ease the assertion condition from contain
to match
Then the output should match:
"""
\[1\] pry\(main\)> input1\n?=> output2
"""
And the output should match:
"""
\[2\] pry\(main\)> input2\n?=> output2
"""
Or use a dummy readline for test
Given an executable named "bin/aruba-test-cli" with:
"""
module DummyReadline
def self.readline(prompt)
gets.tap { |l| puts prompt + l }
end
end
require 'pry'
Pry.start(self, input: DummyReadline)
"""
from aruba.
Thanks @tompng I'll try those.
from aruba.
With #914 merged, Aruba is ready for Ruby 3.3. Next steps are adding documentation that stdout and stderr of our SpawnProcess are not ttys, and then see if we can use PTY to present a tty.
from aruba.
Related Issues (20)
- Use rspec-stubbed-env? HOT 2
- The append_to_file method should provide feedback if file does not exist HOT 3
- Drop support for older Ruby and Cucumber versions HOT 2
- Test with multiple versions of Cucumber HOT 3
- Make be_an_existing_X matchers more useful
- Add windows build to Github Actions
- Documentation site doesn't work HOT 13
- Examine slow-loading dependencies
- Unable to activate aruba-1.0.4 Error HOT 4
- Release aruba/rspec as a standalone gem without cucumber HOT 1
- Help request: Simulating Enter key in an interactive CLI HOT 1
- Rubydoc link is broken HOT 5
- Using Gem.win_platform? may lead to issues HOT 1
- 'Wait for output' steps are broken HOT 7
- Linting fails on too-short description
- Use Process.spawn instead of the child_process gem HOT 1
- Make the documentation about how to configure tests more accessible. HOT 5
- run_command_and_stop(): Windows says "The operation completed successfully.", but it did not.
- Replace Timeout with something else
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from aruba.