Skip to main content

Exit Codes & Signal Handling

envtrap transparently proxies process execution states between the monitored application and the operating system.

Exit Codes


Signal Forwarding

envtrap intercepts standard POSIX signals and propagates them to the child process:

SIGINT (Ctrl+C)

Forwarded to the child process immediately. The parent CLI cleans up the in-memory certificate authority and temp files, prints the run summary, and exits.

SIGTERM

Forwarded directly to the child process to enable graceful shutdown handlers in frameworks like Express and NestJS.

Automatic Resource Cleanup

Upon exit (whether normal, signaled, or blocked), envtrap automatically:
  1. Shuts down the in-memory MITM TLS proxy server.
  2. Deletes the temporary public certificate file (os.tmpdir()/envtrap-ca-*.crt).
  3. Removes Root CA trust from the system trust store if injected.
  4. Writes .envtrap-report.json with the complete incident audit trail.