make.sh: Store the PID in a variable to avoid $! being overwritten

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
This commit is contained in:
Michael Tremer
2024-07-10 17:40:11 +00:00
parent 3e41d45e7b
commit 59e07d4ba8

View File

@@ -777,6 +777,8 @@ execute() {
# Append the command # Append the command
execute+=( "${command[@]}" ) execute+=( "${command[@]}" )
local pid
# Return code # Return code
local r=0 local r=0
@@ -800,9 +802,12 @@ execute() {
"${execute[@]}" >> "${LOGFILE}" 2>&1 </dev/null "${execute[@]}" >> "${LOGFILE}" 2>&1 </dev/null
} & } &
# Store the PID
pid="$!"
# Wait for the process to complete # Wait for the process to complete
while :; do while :; do
wait "$!" wait "${pid}"
# Store the return code # Store the return code
r="$?" r="$?"