diff options
| author | user <user@clank> | 2026-08-14 19:27:54 +0200 |
|---|---|---|
| committer | user <user@clank> | 2026-08-14 19:27:54 +0200 |
| commit | 1b9a23b4c8be1b8009456f0a50ece6422b3c797c (patch) | |
| tree | 7e1d7ba88813d7edd47e349d6f7d59f8ba4688e0 /Makefile | |
| parent | sl0ppty: a pane that rings says so (diff) | |
| download | slosh-1b9a23b4c8be1b8009456f0a50ece6422b3c797c.tar.gz slosh-1b9a23b4c8be1b8009456f0a50ece6422b3c797c.tar.xz slosh-1b9a23b4c8be1b8009456f0a50ece6422b3c797c.zip | |
sl0ppty: saving the config reloads it
The reload existed but you had to ask for it, which is the wrong shape for the
thing it is mostly used for: changing a colour and looking at the result. The
server now watches the config and re-reads it when it changes.
It watches the config's *directory* and filters by name, rather than watching
the file. Editors overwhelmingly save by writing a temporary file and renaming
it over the target, which swaps the inode out from under a watch on the file
itself — it fires once and then never again, which is worse than not watching
at all because it looks like it works. The test writes in place *and* renames
over, because only the second one would have caught that.
Reloading goes through the same call the command does, so it keeps the
fail-open behaviour: a file that does not parse leaves the running config alone
and says so in a toast. That matters more here than it did for the command,
because a file caught halfway through a save is a normal thing for a watcher to
see rather than an operator mistake — and there is a test for it, and for the
recovery once the file is valid again.
Turning it off is a command-line flag rather than a setting, because a setting
would be circular: you would have to reload the config to stop it reloading the
config. --no-reload only stops the *watching*; asking explicitly still works,
which is the distinction the flag name is trying to make.
The test is a live one because inotify lives in the server's poll loop and the
headless driver has no server. It polls for the colour it expects rather than
sleeping a guess, so the passing cases cost milliseconds; the two cases that
assert nothing happened are the only ones that wait, because proving a negative
has to.
Diffstat (limited to 'Makefile')
| -rw-r--r-- | Makefile | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -93,6 +93,8 @@ test-live: $(BIN) ## the checks that need a real tty (slow) python3 tests/live_input.py @echo python3 tests/test_session.py + @echo + python3 tests/live_reload.py test-all: test test-live ## everything |
