Fix Popen not always returning error code
What does this MR do and why?
Process#waitpid
returns Process::Status
, which holds a 16-bit value.
- The higher-order 8 bits hold the exit() code (
exitstatus
). - The lower-order bits holds whether the process was terminated.
Previously if the process didn't exit normally, Gitlab::Popen#popen
would return a status of nil
since exitstatus
would be nil
.
This isn't informative because we want to know what signal killed the
process. We can get this by calling Process::Status.to_i
.
Relates to #351155 (closed)
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
-
I have evaluated the MR acceptance checklist for this MR.
Edited by Stan Hu