code: private function getStatus(): array
      {
          $status = proc_get_status($this->process);
  
          if (!$status['running'] && is_null($this->exitCode)) {
              $this->exitCode = $status['exitcode'];
          }
  
          return $status;
      }
docs: Proxy method to proc_get_status.
  
  This is used so that we always update the exit code when retrieving process status. This works around the issue
  where only the last call after process termination contains the real exit code.
  
  See http://stackoverflow.com/a/7841550 For more information.