aboutsummaryrefslogtreecommitdiff
path: root/tests/tmux-util/fake-kill
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-19 12:24:40 -0500
committerCraig Jennings <c@cjennings.net>2026-05-19 12:24:40 -0500
commit9557006dd2409437a346f66611e6fa2762aa1e63 (patch)
tree0e12cd80cffd557cbbe628c49420d101a1690ae6 /tests/tmux-util/fake-kill
parent3d1a88fa002942c5d5376250b705a6dd8252ab2e (diff)
downloadarchsetup-9557006dd2409437a346f66611e6fa2762aa1e63.tar.gz
archsetup-9557006dd2409437a346f66611e6fa2762aa1e63.zip
feat(tmux-util): add script skeleton and reap subcommand
A new utility in dotfiles/common/.local/bin/ for managing tmux sessions. The eventual plan covers six subcommands (go, pick, ls, find, reap, rename). This commit ships the skeleton, the dispatch + help, and the first subcommand: reap. reap walks every unattached tmux session whose name doesn't match $TMUX_UTIL_REAP_SKIP (default `^aiv-`), sends SIGHUP to each pane's PID (the same signal that fires when you close a terminal window), waits up to three seconds for the session to wind down, and falls back to `tmux kill-session` if anything's still alive. Tests live under tests/tmux-util/ with the same fake-binary-on-PATH pattern layout-navigate uses. fake-tmux reads canned session state from a file and records every invocation. fake-kill records signal calls without sending them. fake-sleep is a no-op so tests don't actually wait. 14 tests cover Normal / Boundary cases for dispatch + reap. Run them with: cd tests && python3 -m unittest tmux-util.test_tmux_util The other five subcommands stub out for now and exit non-zero with "not implemented yet" so future TDD turns can drop them in one at a time.
Diffstat (limited to 'tests/tmux-util/fake-kill')
-rwxr-xr-xtests/tmux-util/fake-kill11
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/tmux-util/fake-kill b/tests/tmux-util/fake-kill
new file mode 100755
index 0000000..a157e32
--- /dev/null
+++ b/tests/tmux-util/fake-kill
@@ -0,0 +1,11 @@
+#!/bin/sh
+# Fake kill for testing tmux-util.
+#
+# Records every invocation to $FAKE_TMUX_DIR/kill.log as one line per call.
+# Format: kill <args>
+# Exits 0 unconditionally — tests assert on the log, not the actual signaling.
+
+: "${FAKE_TMUX_DIR:?FAKE_TMUX_DIR must be set}"
+
+printf 'kill %s\n' "$*" >> "$FAKE_TMUX_DIR/kill.log"
+exit 0