fix: handle missing DBus session on headless servers - #11
Open
fegauthier-paragon wants to merge 1 commit into
Open
fix: handle missing DBus session on headless servers#11fegauthier-paragon wants to merge 1 commit into
fegauthier-paragon wants to merge 1 commit into
Conversation
When running on a headless server without a DBus session bus, MessageBus().connect() throws an exception causing the CLI to crash. Since the GUI cannot be running without DBus, we catch the exception and return False, allowing the CLI to proceed normally. Fixes ProtonVPN#2
|
Based on your proposal, as I am not interested in GUI, I tried on Debian 13 GNOME via SSH (see #1): async def _vpn_gui_running() -> bool:
return Falsebut now face: protonvpn --verbose connectOutput:Personal notes: Benjamin_Loison/proton-vpn-cli/issues/4 |
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.
Summary
_vpn_gui_running()DBus call in a try/except to gracefully handle headless environments where no DBus session bus is availableFalse(no GUI can be running without DBus), allowing the CLI to proceed normallyProblem
On headless Linux servers (no display, no DBus session), the CLI crashes at startup because
MessageBus(bus_type=BusType.SESSION).connect()throws an unhandled exception. This prevents any CLI usage on servers — even basic commands likesigninorconnect.Related: #2
Test plan
--helpstill works in both environments