Harden Hub startup and display-name handling
- Display names starting with '-' were parsed by tmux rename-window as flags. The alias was persisted before tmux rejected it, so every later start/refresh/open failed in refresh_labels until aliases.json was edited by hand. Guard rename-window with '--', apply the name before persisting it, and roll back the in-memory table on failure. - Start the Hub tmux server with -f /dev/null by default. Reading the user's ~/.tmux.conf let theme status-formats replace the Sessions bar and root-table bindings leak into Herdr; HERDR_HUB_TMUX_CONFIG still opts into a custom file. - An unreadable aliases.json blocked start/refresh/open/choose. Degrade to default names with a warning (stderr, or the popup message) and leave the file untouched for `doctor` to report. - `doctor` crashed with a traceback when a *_BIN override pointed at a missing executable; report it as a failure instead. - Refuse to run inside another tmux server before discovery and server creation, so no unattached Hub is left behind. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
@@ -310,6 +310,16 @@ class TmuxIntegrationTests(unittest.TestCase):
|
||||
renamed = self.hub.apply_alias(window.key, "临时名称")
|
||||
assert renamed is not None
|
||||
self.assertEqual(renamed.name, "临时名称")
|
||||
# tmux parses a leading '-' as a flag unless the name is guarded; a
|
||||
# stored name like this must also survive the label refresh that every
|
||||
# later start/refresh performs.
|
||||
dashed = self.hub.apply_alias(window.key, "-dash")
|
||||
assert dashed is not None
|
||||
self.assertEqual(dashed.name, "-dash")
|
||||
self.hub.ensure_server()
|
||||
refreshed = self.hub.window_for_key(window.key)
|
||||
assert refreshed is not None
|
||||
self.assertEqual(refreshed.name, "-dash")
|
||||
restored = self.hub.apply_alias(window.key, "")
|
||||
assert restored is not None
|
||||
self.assertEqual(restored.name, "R orangepi/work")
|
||||
|
||||
Reference in New Issue
Block a user