fix: let go of final readline before exiting #3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi!
![image](https://user-images.githubusercontent.com/64952797/230591103-9e70c4cd-84ab-4447-9169-487fb1e326f8.png)
![image](https://user-images.githubusercontent.com/64952797/230591120-f63054c3-6e8c-4e63-8452-33a5528d0ecf.png)
So, I got annoyed about something and decided to fix it.
exhibits:
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 :)