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

fix: let go of final readline before exiting #3

Closed
wants to merge 1 commit into from

Conversation

Peedee2002
Copy link

@Peedee2002 Peedee2002 commented Apr 7, 2023

Hi!
So, I got annoyed about something and decided to fix it.
exhibits:
image
image
here, the server on the other end of the client hung up. This causes ircat to exit. However, it does not correctly reset the cursor of my terminal!
so you can see that I can no longer ever see the last line of my terminal. This is quite annoying, because I usually am typing on that line. Creating new terminals that are on the same machine in cse is a little annoying, so I would prefer to be able to use the same terminal.

The reason this happens is because the network thread exits the whole process while the input thread is blocked on rustyline::Editor::readline. This causes readline to leave my terminal in a bad state.
My change now tells the input thread to kill the client, which will then release my terminal correctly before exiting.

I believe libc works fine on any machine, but admittedly I only tested this on wsl.

this took me too long to figure out how to do, because I went down trying to write to my own process's stdin 💀

Thanks :)

@Peedee2002 Peedee2002 force-pushed the fix-terminal-glich branch from 12e4e9a to b4bc19c Compare April 7, 2023 10:19
@Peedee2002 Peedee2002 changed the title fix: lets go of final readline before exiting fix: let go of final readline before exiting Apr 7, 2023
@Peedee2002 Peedee2002 closed this May 11, 2024
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.

1 participant