Skip to content

Exit Codes

l0-cache propagates the child process exit code as its own. The following codes have special meaning.

Standard Exit Codes

CodeMeaning
0Child exited successfully
1-125Child exited with error (code passed through)
126Child found but not executable, or blocked by the Safety Guard
127Child command not found, or /bin/sh not found

Signal Exit Codes (POSIX Convention)

When the child process is killed by a signal, l0-cache reports the exit code as 128 + signal_number. This follows the POSIX/bash convention.

CodeSignalCommon Cause
130SIGINT (2)User pressed Ctrl-C
131SIGQUIT (3)User pressed Ctrl-\
137SIGKILL (9)kill -9, OOM killer
139SIGSEGV (11)Segmentation fault in child
141SIGPIPE (13)l0-cache cmd | head (pipe closed)
143SIGTERM (15)kill (default signal)

Proxy-Specific Codes

CodeMeaning
127l0-cache itself failed to start the child (command not found, /bin/sh missing)
141l0-cache detected BrokenPipe on stdout (e.g. l0-cache cmd | head)

Behavior on Signals

The captured child runs in its own process group. When l0-cache receives SIGINT (Ctrl-C) or SIGTERM (kill, timeout, systemd, docker stop):

  1. l0-cache's signal handler forwards the signal to the child's process group, so the whole child subtree (pipelines, grandchildren) receives it.
  2. The child handles the signal (typically exits); its stdout pipe closes.
  3. l0-cache finishes reading, calls child.wait(), and collects the status.
  4. l0-cache reports 128 + signal_number (e.g. 130 for SIGINT, 143 for SIGTERM).

This both lets the child terminate cleanly and ensures l0-cache always completes its own cleanup (metrics logging) before exiting. SIGPIPE is ignored so that l0-cache cmd | head can log metrics before exiting 141.