The author investigates why a segmentation fault message disappears when running a C program through the `entr` utility and `bash -c`. The issue stems from bash's optimization to `exec` commands instead of forking, which prevents the parent shell from reaping the crashed child process and printing the error. Using a wrapper script forces proper process forking and reaping, restoring the expected error output.
Background
`entr` is a popular Unix utility for executing commands when files change, widely used in development workflows. This article highlights a subtle but common pitfall in shell process management that can obscure critical runtime errors.
- Source
- Lobsters
- Published
- Jul 12, 2026 at 05:05 AM
- Score
- 5.0 / 10