Skip to content

Gracefully exit terminal on error#148

Closed
Dolphindalt wants to merge 2 commits into
pythops:masterfrom
Dolphindalt:jdepp/graceful-terminal-exit
Closed

Gracefully exit terminal on error#148
Dolphindalt wants to merge 2 commits into
pythops:masterfrom
Dolphindalt:jdepp/graceful-terminal-exit

Conversation

@Dolphindalt

Copy link
Copy Markdown
Contributor

Related to #118.

Running bluetui while 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 unit

The 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 bluetui is 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:

  1. Running application with bluetooth service disabled and verified terminal is restored
  2. Run application with bluetooth service enabled then disabled the service during runtime and verified terminal is restored

@pythops

pythops commented Jun 28, 2026

Copy link
Copy Markdown
Owner

the PR does not fix the issue actually, and I am not sure I like the change.

@pythops pythops closed this Jun 28, 2026
@Dolphindalt Dolphindalt deleted the jdepp/graceful-terminal-exit branch June 28, 2026 17:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants