While the relevant comment says:
'# Execute the command and prepend the output with its pid'
the actual PID logged is the same for all background processes,
which isn't very helpful.
Signed-off-by: Ronen Friedman <rfriedma@redhat.com>
shift
# Execute the command and prepend the output with its pid
# We enforce to return the exit status of the command and not the sed one.
- ("$@" |& sed 's/^/'$$': /'; return "${PIPESTATUS[0]}") >&2 &
+ ("$@" |& sed 's/^/'$BASHPID': /'; return "${PIPESTATUS[0]}") >&2 &
eval "$pid_variable+=\" $!\""
}