Skip to content

Fix: --close-running quits the old instance without starting a new one - #650

Open
mhlas7 wants to merge 1 commit into
StreamController:mainfrom
mhlas7:fix-close-running-restart
Open

mhlas7 wants to merge 1 commit into
StreamController:mainfrom
mhlas7:fix-close-running-restart

Conversation

@mhlas7

@mhlas7 mhlas7 commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

--close-running closes the app instead of restarting it, so the dev launch documented in the README and .vscode/launch.json (python3 main.py --devel --data data --close-running) ends with nothing running.

quit_running() asks the running instance to quit with Activate("quit", [], []). The instance drops off the bus while quitting, so it never sends a method reply and dbus-python raises org.freedesktop.DBus.Error.NoReply: Remote peer disconnected. That disconnect is the expected outcome of a successful quit, but it was logged as an error and followed by sys.exit(0) — so the time.sleep(5) and the startup after it never ran.

Before

INFO   Closing running instance
ERROR  Could not close running instance: org.freedesktop.DBus.Error.NoReply: Remote peer disconnected

Old instance gone, no new instance, decks left unmanaged.

After

INFO   Closing running instance
INFO   Running instance closed
INFO   Loaded page VSCode on deck <serial>

One command: the old instance quits and the new one starts. Verified against real hardware with the app running.

A second change in the same handler

Any other DBusException previously fell through the unmatched if and was swallowed, letting startup continue while the old instance may still have been holding the decks. Those now log and exit non-zero, on the grounds that a second instance fighting over the same hardware is worse than a clear failure. Happy to drop this half if you would rather keep the diff to the NoReply branch alone.

🤖 Generated with Claude Code

@mhlas7
mhlas7 marked this pull request as ready for review September 3, 2026 04:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

1 participant