Run a command everytime a line is written to a unix socket, passing
the line written as the last argument to the command. Useful in an
after-save-hook
in emacs to run tests after the buffer is saved.
Unlike file-watchers, this allows more precise control of when the
tests are run, reducing the amount of time spent configuring ignore
files and waiting for spurious reruns.
Choose either building with zig:
zig build --verbose
Or nix:
nix build github:fiddlerwoaroof/sigexec
One can also run the flake’s default app like:
nix run github:fiddlerwoaroof/sigexec <socket> <command...>
rm /tmp/jest.sock ; $OLDPWD/zig-out/bin/zig-test /tmp/jest.sock npx jest --
% nix run github:fiddlerwoaroof/sigexec /tmp/bar.sock echo NOTICE ME: input:
# output:
# warning: listening at /tmp/bar.sock
#
# NOTICE ME: input: 4
# in another terminal:
% echo 4 | socat - unix-connect:/tmp/bar.sock
# ACK!