Crates.io | swaperooni |
lib.rs | swaperooni |
version | 0.1.0 |
source | src |
created_at | 2023-12-31 21:38:41.338051 |
updated_at | 2023-12-31 21:38:41.338051 |
description | Hot-reload child process in response to user provided events. Proxies signals into the child process. |
homepage | |
repository | https://github.com/cdaringe/swaperooni |
max_upload_size | |
id | 1085015 |
size | 39,508 |
Hot-reload a child process without tearing down the parent PID. Proxies signals into the child process.
swaperooni
exits with the same code.Supports two hot-reload request options:
ipc
- send a newline delimited command string from the child to the swaperooni socket. See examples/ipc_bash_hopscotch/main.sh.poll
- monitor the mtime
of a file. on change, re-execute it.swaperooni is not a supervisor. swaperooni
is similar to tini.
Because you can. Generally, avoid using this, and use a supervisor/orchestrator. You may have cases where swapping child PIDs is more desirable (e.g. oddball docker/k8s environments).
See the examples.
SOCKET_PATH=demo.sock cargo run ipc -- bash examples/ipc_bash_hopscotch/a.sh
a
runs momentarily, then requests to be swapped for program b
. b
requests program c
, and c
gracefully exits.SOCKET_PATH=demo.sock cargo run ipc -- node examples/ipc_node_counter/index.mjs 0
cargo run poll --poll-interval-ms=1000 -- examples/poll_countdown/main.sh 5
Well, it is <1MB and does nothing most of the time.