I have an issue where when I lose connection to server, my program cleanly terminates, however the complete termination of the program is blocked till I press enter ( due to it being stuck in the input ). Normally once text has been entered, it would check if the connection is still alive before requesting another input.
Is it possible to cancel a prompt when it detects a variable change?