Fix `exit_code` (#1679)
This commit is contained in:
parent
f0a6adb96d
commit
79eb6bba62
|
|
@ -355,10 +355,12 @@ class SysCommandWorker:
|
||||||
if self.ended or (got_output is False and pid_exists(self.pid) is False):
|
if self.ended or (got_output is False and pid_exists(self.pid) is False):
|
||||||
self.ended = time.time()
|
self.ended = time.time()
|
||||||
try:
|
try:
|
||||||
self.exit_code = os.waitpid(self.pid, 0)[1]
|
wait_status = os.waitpid(self.pid, 0)[1]
|
||||||
|
self.exit_code = os.waitstatus_to_exitcode(wait_status)
|
||||||
except ChildProcessError:
|
except ChildProcessError:
|
||||||
try:
|
try:
|
||||||
self.exit_code = os.waitpid(self.child_fd, 0)[1]
|
wait_status = os.waitpid(self.child_fd, 0)[1]
|
||||||
|
self.exit_code = os.waitstatus_to_exitcode(wait_status)
|
||||||
except ChildProcessError:
|
except ChildProcessError:
|
||||||
self.exit_code = 1
|
self.exit_code = 1
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue