Skip to content

Releases: digivasserver-ai/durable-sh

v0.1.0 — Signal-36 hardened shell primitives

Choose a tag to compare

@digivasserver-ai digivasserver-ai released this 24 Oct 21:05

First tagged release.

durable.sh is a single-file, dependency-free bash library for environments where
short-lived processes get killed — notably Android/Termux, where traced_perf
delivers signal 36 (SIGRTMIN+2) and the default disposition is terminate.

What's in it

  • trap '' 36 immunity — SIG_IGN is inherited across fork+exec and cannot be
    reset by children, so one line protects every descendant.
  • Atomic writes — durable::atomic_write / durable::atomic_write_str
    (tmp on the same filesystem + mv), so a kill leaves a missing file instead of
    a truncated live one.
  • Parent-shell retries — durable::retry retries in the parent, not in a
    subshell that inherits the kill.
  • Git hardening — stale index.lock recovery, and rc disambiguation for
    git diff --cached --quiet (0 clean / 1 changes / >1 killed).
  • Supervision helpers — liveness by process pattern, never by trusting a
    pidfile.

Verification

  • bash tests/run_tests.sh → 18/18 pass
  • Kill-rate measurements in the README: 0/40 at sleep 0.001, 6/40 at 0.2 s,
    ~12% at 3 s — risk plateaus, so longer processes buy nothing.

Install

git clone https://github.com/digivasserver-ai/durable-sh.git
source durable-sh/lib/durable.sh

MIT licensed.