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

Update to run when connected to a pipe #147

Closed
wants to merge 1 commit into from

Conversation

MSP-Greg
Copy link

New work being done on Byebug showed that using rb-readline with pipes for input & output odes not function, as windows code defaults to keyboard API's.

This is not uncommon with testing, and it is one of the reasons rb-readline does poorly with ruby's readline tests. More fixes for that later.

This uses io/console's winsize attribute to determine this, and changes behavior accordingly.

@@ -4740,6 +4748,7 @@ def _rl_internal_char_cleanup()
def readline_internal_charloop()
lastc = -1
eof_found = false
@is_pipe = (!@rl_outstream.winsize rescue true)
Copy link

@deivid-rodriguez deivid-rodriguez Jan 11, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it could work if we checked !@rl_outstream.tty?, that way we don't introduce the io/console dependency...

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think it could work if we checked !@rl_outstream.tty?

I checked every reasonably obvious means of testing for it in core, and I'm sure I tried tty. Nothing worked.

But, I should check in _rl_get_screen_size, as it might show the same info.

we don't introduce the io/console dependency...

I'm not bothered about a std-lib/default gem dependency, given that rb-readline isn't turning away collaborators. If this repo can make use of c code wrapped there, less support required here.

@Spakman
Copy link
Collaborator

Spakman commented Aug 3, 2019

I'd love for us to get rb-readline working with pipes!

As I'm sure you're by now aware, rb-readline can be a rather unforgiving mistress (due to the built up years of development on GNU Readline, of which this is basically a line for line port). Do you have any test programs to hand that you're using to verify it's doing what you expect?

I'd like us to remove the dependency on io/console if possible, but since it's in stdlib I would definitely rather have it in there and pipes working if not.

@MSP-Greg
Copy link
Author

MSP-Greg commented Aug 4, 2019

I haven't taken the time to look at it, but ruby/reline might be something to look at. I suspect it's much more UTF-8 friendly...

@MSP-Greg
Copy link
Author

Closing due to availability of reline

@MSP-Greg MSP-Greg closed this Mar 20, 2020
@MSP-Greg MSP-Greg deleted the byebug branch March 20, 2020 18:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants