diff options
| author | sl0p <sl0p@sl0p.foo> | 2026-08-13 23:27:47 +0200 |
|---|---|---|
| committer | sl0p <sl0p@sl0p.foo> | 2026-08-13 23:27:47 +0200 |
| commit | 58afd137373fb395fc0479d091c4da9ffa60324a (patch) | |
| tree | 93839e3c20ff722819444ed22deaef07dc6e6041 /tests/live_m0.py | |
| parent | sl0ptty: M6 — the config file, and a README (diff) | |
| download | slosh-58afd137373fb395fc0479d091c4da9ffa60324a.tar.gz slosh-58afd137373fb395fc0479d091c4da9ffa60324a.tar.xz slosh-58afd137373fb395fc0479d091c4da9ffa60324a.zip | |
sl0ptty: M7 — layout files and suspended panes
A session can be a file:
layout {
tab name="api" purpose="project:api.a1b2c3" cwd="~/dev/api" {
pane purpose="agent:main" command="pi"
pane split="rows" {
pane purpose="service:web" command="npm run dev" suspended=true
pane purpose="shell:scratch"
}
}
}
built by --layout at startup or applied to a running session with
{"cmd":"apply-layout", path|kdl, replace?}. Idempotency stays with the caller,
which is where sl0ppi's CLI design already puts it: diff list-tabs against the
projects on disk, then apply what is missing. close-tab completes that loop.
Purposes a layout declares are locked, so identity comes from the file rather
than from whatever the program inside prints — tested by having a pane try to
take one in-band and be refused.
Suspended panes: a pane that exists, is laid out, and has run nothing, showing
what it would run and starting on its first keystroke (which is consumed, not
forwarded). This is sl0ppi's D6 — a root with twelve projects must not become
twelve running servers — and it is the reason can be cheap.
Also fixes a test-isolation bug latent since M2: the live tests attached to the
session called "main", which is whatever happens to exist on the box rather
than one they created. They now use a unique session per run, which is how a
run that had somebody else's htop in it became reproducible.
284 checks green (257 headless + 27 live).
Diffstat (limited to 'tests/live_m0.py')
| -rw-r--r-- | tests/live_m0.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/tests/live_m0.py b/tests/live_m0.py index 58720c2..ead8092 100644 --- a/tests/live_m0.py +++ b/tests/live_m0.py @@ -4,16 +4,22 @@ The headless dump proves composition; this proves the parts headless cannot: raw mode, the diff emitter, SIGWINCH, and the quit path. """ -import os, pty, re, select, signal, struct, subprocess, sys, termios, time, fcntl +import os, pty, uuid, re, select, signal, struct, subprocess, sys, termios, time, fcntl BIN = os.path.join(os.path.dirname(__file__), "..", "build", "sl0ptty") +# A unique session per run. Without this the tests attach to whatever "main" +# happens to exist on the box, which is somebody else's terminal. +SESSION = "test-" + uuid.uuid4().hex[:8] + + def spawn(cols=60, rows=12, argv=None): pid, fd = pty.fork() if pid == 0: os.environ["TERM"] = "xterm-ghostty" - os.execv(BIN, [BIN] + (argv or ["--", "/bin/sh", "-i"])) + os.environ["SL0PTTY_CONFIG"] = "/nonexistent/sl0ptty.kdl" + os.execv(BIN, [BIN, "-s", SESSION] + (argv or ["--", "/bin/sh", "-i"])) os._exit(127) fcntl.ioctl(fd, termios.TIOCSWINSZ, struct.pack("HHHH", rows, cols, 0, 0)) return pid, fd |
