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

Handle control C #50

Closed
bitspittle opened this issue Sep 8, 2021 · 4 comments
Closed

Handle control C #50

bitspittle opened this issue Sep 8, 2021 · 4 comments
Assignees
Labels
enhancement New feature / functionality
Milestone

Comments

@bitspittle
Copy link
Contributor

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.

@bitspittle bitspittle added the enhancement New feature / functionality label Sep 8, 2021
@bitspittle bitspittle added this to the 1.0 milestone Sep 8, 2021
@bitspittle
Copy link
Contributor Author

bitspittle commented Sep 9, 2021

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?

@bitspittle
Copy link
Contributor Author

When done, we should use this in Kobweb#CreateFlow to throw this exception instead of return@konsoleApp

@bitspittle bitspittle self-assigned this Sep 9, 2021
@bitspittle
Copy link
Contributor Author

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.

bitspittle added a commit that referenced this issue Sep 9, 2021
@bitspittle
Copy link
Contributor Author

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.

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

No branches or pull requests

1 participant