Gracefully exit terminal on error#148
Closed
Dolphindalt wants to merge 2 commits into
Closed
Conversation
Owner
|
the PR does not fix the issue actually, and I am not sure I like the change. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Related to #118.
Running
bluetuiwhile the bluetooth service is not running results in the following error:Error: internal error: D-Bus error org.freedesktop.DBus.Error.NameHasNoOwner: Could not activate remote peer 'org.bluez': activation request failed: unknown unitThe side effect of the program exiting is that the terminal is stuck in raw mode and did not get cleaned up. This is true for other runtime errors, i.e., if the bluetooth service is disabled while
bluetuiis running.This PR pulls out the running of the application code in a separate function and then performs the terminal cleanup before reporting the result. Note that if both the application and terminal cleanup result in an error, then the application error is prioritized, though this is an unlikely case.
Testing: