Closed bitspittle closed 3 years ago
Possibly we should create a AbortKonsoleException(val message: String, val errorCode = -1) which we catch in the KonsoleApp, fire all handlers, clear all data (ConcurrentScopedData stopAll?), and then exit with an error code?
When done, we should use this in Kobweb#CreateFlow to throw this exception instead of return@konsoleApp
The exception idea is bad and I should feel bad :) Often we'll want to abort from run handlers, but at that point we'll be in a different thread.
We probably need something like KonsoleApp#abort
which somehow causes the app to exit at that point after cleaning up resources.
Closing this issue as we now dispose the konsole app data on Ctrl C, it's probably as good as it's going to get.
Note that #52 is still open for dealing with restoring console state, which we should still definitely do.
We should restore the cursor when the user presses Ctrl+C, and probably add handler methods to KonsoleBlock and KonsoleApp that get triggered as well so users can clean up if it happens.