• Stan Hu's avatar
    Fix Popen not always returning error code · 93b8cae9
    Stan Hu authored
    `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 https://gitlab.com/gitlab-org/gitlab/-/issues/351155
    
    Changelog: fixed
    93b8cae9
popen.rb 2.01 KB