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

Backspace fails when using Open3 #63

Open
kevjames3 opened this issue Apr 10, 2014 · 18 comments · May be fixed by #604
Open

Backspace fails when using Open3 #63

kevjames3 opened this issue Apr 10, 2014 · 18 comments · May be fixed by #604
Labels

Comments

@kevjames3
Copy link

Shout out to Deivid: Long time, no talk :). Here is an interesting bug...

require 'open3'

include Open3

Open3.popen2e('echo Hello') do |input, stdOutErr, waitThread|
   byebug
end

Try entering a series of characters, and then pressing backspace. You are unable to press backspace on the command prompt and have it register on the interface (buffer flushing problem?). Pressing enter does register the inputs.

For example, I type in byebug at the breakpoint "stdErrf", then I try to erase the 'f' with backspace, the interface does not update. However, if I press enter, the value of stdErr is returned as the underlying workings registered the keyboard input, just not the interface.

Additional Info:

Ruby Version: ruby 2.0.0p247 (2013-06-27) [i386-mingw32]
OS: Windows 7, Intel Processor
Byebug Version: 2.7.0

@deivid-rodriguez
Copy link
Owner

Hi @kevjames3! You're back! And with you, your easy to reproduce bug reports!

Thanks man, I'll have a look soon.

@deivid-rodriguez
Copy link
Owner

Hi @kevjames3! I couldn't reproduce this with your sample program but this is exactly the same issue I get when I use byebug to debug a server started with foreman start.

The problem here is that foreman handles output by the processes it starts "line by line", so until a full line is not in the corresponding process output buffer, foreman won't print it. This works well for foreman because it's usually used to start proceses that require no user input...

The bigger problem in my case is that terminal echoing is permanently turned off, and that I don't know why... Not sure how to solve this or #59.

@kevjames3
Copy link
Author

Well that is just messy. Did you try to reproduce this on Windows? If you have, then I have just the strangest desktop machine ever.

@deivid-rodriguez
Copy link
Owner

No I haven't... I will eventually!

@maxwell
Copy link

maxwell commented Aug 8, 2014

hey @ddollar, I don't think this is your bug, but do you happen to have any insight as to how to get around foreman seemingly not flushing the buffer on user input?

I guess this worked on previous rubies, with the debugger gem, so there must be some sort of workaround!

@ddollar
Copy link

ddollar commented Aug 11, 2014

Foreman does not even hook up stdin from the controlling terminal to any of the underlying processes (how would it know which one to send to?) so I'm not sure it will work here.

@maxwell
Copy link

maxwell commented Aug 11, 2014

@ddollar thank you so much for helping us understand here. I appreciate you taking the time, and foreman very much.

@deivid-rodriguez, do you happen to know how your terminal handling code differs from normal debugger from 2.0? I know it seemed to work, even with foreman, so perhaps there is a cool trick there we could take advantage of?

@deivid-rodriguez
Copy link
Owner

No but feel free to investigate! I suggest you try the initial byebug release and if it works, write a test and use git bisect to find the offending commit.

@deivid-rodriguez
Copy link
Owner

@kevjames3 I've been able to reproduce this on Windows. It seems like a very edge case because placing the byebug call anywhere else works.

@luislavena Do you think this could be related to readline. It seems that backspace has problems sometimes under Windows, right? Thanks!

@kevjames3
Copy link
Author

Fair enough, glad it is not just my desktop

@davetapley
Copy link

Do we want to expand this issue to include it happening under Foreman, or shall I start a new one?
Here's a video of how I see it.

@deivid-rodriguez
Copy link
Owner

I really don't know where the boundary between this issue and #59 is. In any case, I'm aware of issues with Byebug not echoing to terminal.

@sethk
Copy link
Contributor

sethk commented Mar 23, 2016

This could be fixed by bb98cd6.

@deivid-rodriguez
Copy link
Owner

Could somebody experiencing this try latest master? :)

@kevjames3
Copy link
Author

@deivid-rodriguez wish I could, but I have moved onto another project that does not have an ENV enabled for this :(

@deivid-rodriguez
Copy link
Owner

Thanks anyways @kevjames3

@Startouf
Copy link

Sorry for the long wait. I still have problems on byebug (9.0.5), will try to use your master branch for a while to see if this happens again.

@deivid-rodriguez
Copy link
Owner

@Startouf Note that you have to manually reapply bb98cd6, which is not currently in master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants