aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgbc dev <gbc@localhost>2026-07-15 10:10:16 +0200
committergbc dev <gbc@localhost>2026-07-15 10:10:16 +0200
commitd52d92092d98ed2d6c48e6433cacb899582f617e (patch)
tree7e835fb815d6ec868b2362b37bab63f8365857dc
parentfix(control): ignore SIGPIPE so a vanishing client can't kill the emulator (diff)
downloadsl0pboy-d52d92092d98ed2d6c48e6433cacb899582f617e.tar.gz
sl0pboy-d52d92092d98ed2d6c48e6433cacb899582f617e.tar.xz
sl0pboy-d52d92092d98ed2d6c48e6433cacb899582f617e.zip
gbctl: 'hud' kills any existing HUD pane before spawning (no double-HUD)
gbctl hud now scans tmux for panes started with gbhud.py and kills them before spawning, so there's never more than one HUD (fixes the double-spawn flicker). Added 'gbctl hud --kill' to just tear the HUD down.
-rw-r--r--core.3094252bin0 -> 11268096 bytes
-rw-r--r--core.3095917bin0 -> 11268096 bytes
-rw-r--r--core.3096524bin0 -> 11268096 bytes
-rw-r--r--core.3096981bin0 -> 11268096 bytes
-rw-r--r--core.3103352bin0 -> 11268096 bytes
-rw-r--r--core.3104381bin0 -> 11268096 bytes
-rw-r--r--core.3107696bin0 -> 11268096 bytes
-rw-r--r--core.3112782bin0 -> 11268096 bytes
-rw-r--r--core.3114457bin0 -> 11268096 bytes
-rw-r--r--core.3115685bin0 -> 11268096 bytes
-rw-r--r--core.3117279bin0 -> 11268096 bytes
-rw-r--r--core.3118071bin0 -> 11268096 bytes
-rwxr-xr-xgbctl27
13 files changed, 26 insertions, 1 deletions
diff --git a/core.3094252 b/core.3094252
new file mode 100644
index 0000000..8da34bb
--- /dev/null
+++ b/core.3094252
Binary files differ
diff --git a/core.3095917 b/core.3095917
new file mode 100644
index 0000000..549133c
--- /dev/null
+++ b/core.3095917
Binary files differ
diff --git a/core.3096524 b/core.3096524
new file mode 100644
index 0000000..04786a5
--- /dev/null
+++ b/core.3096524
Binary files differ
diff --git a/core.3096981 b/core.3096981
new file mode 100644
index 0000000..b3a5c51
--- /dev/null
+++ b/core.3096981
Binary files differ
diff --git a/core.3103352 b/core.3103352
new file mode 100644
index 0000000..230f6a2
--- /dev/null
+++ b/core.3103352
Binary files differ
diff --git a/core.3104381 b/core.3104381
new file mode 100644
index 0000000..4c71880
--- /dev/null
+++ b/core.3104381
Binary files differ
diff --git a/core.3107696 b/core.3107696
new file mode 100644
index 0000000..965f8c9
--- /dev/null
+++ b/core.3107696
Binary files differ
diff --git a/core.3112782 b/core.3112782
new file mode 100644
index 0000000..88d4aca
--- /dev/null
+++ b/core.3112782
Binary files differ
diff --git a/core.3114457 b/core.3114457
new file mode 100644
index 0000000..1c71b59
--- /dev/null
+++ b/core.3114457
Binary files differ
diff --git a/core.3115685 b/core.3115685
new file mode 100644
index 0000000..5d7c329
--- /dev/null
+++ b/core.3115685
Binary files differ
diff --git a/core.3117279 b/core.3117279
new file mode 100644
index 0000000..3973114
--- /dev/null
+++ b/core.3117279
Binary files differ
diff --git a/core.3118071 b/core.3118071
new file mode 100644
index 0000000..f45e7a0
--- /dev/null
+++ b/core.3118071
Binary files differ
diff --git a/gbctl b/gbctl
index 4c3d4f9..287b16a 100755
--- a/gbctl
+++ b/gbctl
@@ -284,11 +284,35 @@ def cmd_screen(argv):
r = subprocess.run(args, capture_output=True, text=True)
sys.stdout.write(r.stdout)
+def _kill_hud_panes():
+ # kill any pane whose start command references the HUD, so there's never
+ # more than one HUD running (avoids the double-spawn tmux flicker).
+ n = 0
+ try:
+ r = subprocess.run(
+ ["tmux", "list-panes", "-a", "-F", "#{pane_id}\t#{pane_start_command}"],
+ capture_output=True, text=True)
+ for line in r.stdout.splitlines():
+ pid, _, startcmd = line.partition("\t")
+ if "gbhud.py" in startcmd:
+ subprocess.run(["tmux", "kill-pane", "-t", pid], capture_output=True)
+ n += 1
+ except Exception:
+ pass
+ return n
+
def cmd_hud(argv):
# spawn a tmux pane running the live debug HUD, bound to the resolved socket
+ killonly = "--kill" in argv
+ if killonly:
+ argv = [a for a in argv if a != "--kill"]
+ k = _kill_hud_panes()
+ print("killed %d hud pane(s)" % k)
+ return
sock_path = _resolve_sock(argv)
if "TMUX" not in os.environ:
die("not inside tmux; gbctl hud needs a tmux session")
+ killed = _kill_hud_panes() # never leave a second HUD around
hud = os.path.join(HERE, "tools", "gbhud.py")
split = "-h"
if "--split" in argv:
@@ -298,7 +322,8 @@ def cmd_hud(argv):
capture_output=True, text=True)
if r.returncode != 0:
die("tmux spawn failed: %s" % r.stderr.strip())
- print("hud pane=%s sock=%s" % (r.stdout.strip(), sock_path))
+ note = (" (replaced %d)" % killed) if killed else ""
+ print("hud pane=%s sock=%s%s" % (r.stdout.strip(), sock_path, note))
def cmd_monitor(argv):
secs = float(argv[0]) if argv and _isnum(argv[0]) else None