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:
- Shuts down the in-memory MITM TLS proxy server.
- Deletes the temporary public certificate file (
os.tmpdir()/envtrap-ca-*.crt). - Removes Root CA trust from the system trust store if injected.
- Writes
.envtrap-report.jsonwith the complete incident audit trail.
