bundle/commands/exec: fix exit code handling.

In some `brew tests` runs, `$CHILD_STATUS` can be `nil`.
Let's handle this and avoid these flaky tests.
This commit is contained in:
Mike McQuaid 2025-05-21 16:31:30 +01:00
parent 8b32d019d4
commit e8e8fcea02
No known key found for this signature in database

View File

@ -178,7 +178,9 @@ module Homebrew
exit_code = 0 exit_code = 0
run_services(@dsl.entries) do run_services(@dsl.entries) do
Kernel.system(*args) Kernel.system(*args)
exit_code = $CHILD_STATUS.exitstatus if (system_exit_code = $CHILD_STATUS&.exitstatus)
exit_code = system_exit_code
end
end end
exit!(exit_code) exit!(exit_code)
else else