Record the errno if exec fails

This commit is contained in:
Graham Christensen
2021-11-18 13:46:56 -05:00
parent 4ce8239cea
commit 5bb3e2be78
3 changed files with 56 additions and 3 deletions

View File

@ -161,9 +161,9 @@ sub buildFinished {
$runlog->started();
system("$command") == 0
or warn "notification command '$command' failed with exit status $?\n";
or warn "notification command '$command' failed with exit status $? ($!)\n";
$runlog->completed_with_child_error($?);
$runlog->completed_with_child_error($?, $!);
}
}

View File

@ -197,7 +197,10 @@ sub completed_with_child_error {
if ($child_error == -1) {
# -1 indicates `exec` failed, and this is the only
# case where the reported errno is valid.
$errno = $reported_errno;
#
# The `+ 0` is because $! is a dual var and likes to be a string
# if it can. +0 forces it to not be. Sigh.
$errno = $reported_errno + 0;
}
if (WIFEXITED($child_error)) {