As other people said, using "if" instead of "foreground" is the
idiomatic way to exit on child error. I myself am a staunch
"#!/bin/sh -e" user, and almost never use "foreground" in execline
scripts - only when I specifically need the exit code of some command.
Forwarding signals to a child is only desirable in two cases: when
you're performing job control, and when for some reason you cannot exec
a long-lived process and have to run it as a child.
execline isn't supposed to be an interactive language so job control
is out of its scope. And to perform signal forwarding on long-lived
children, it provides the "trap" binary.
Hope this helps,
--
Laurent
Received on Tue Sep 06 2022 - 05:21:59 CEST