mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-07-21 09:10:10 +00:00
criu-ns: Add support for older Python version in CI
These changes remove and update the changes introduced in
7177938e60 in favor of the
Python version in CI.
os.waitstatus_to_exitcode() function appeared in Python 3.9
Related to: #1909
Signed-off-by: Dhanuka Warusadura <csx@tuta.io>
This commit is contained in:
parent
f308272062
commit
38db5e1f2f
1 changed files with 13 additions and 1 deletions
|
|
@ -71,7 +71,19 @@ def _wait_for_process_status(criu_pid):
|
|||
try:
|
||||
(pid, status) = os.wait()
|
||||
if pid == criu_pid:
|
||||
return os.waitstatus_to_exitcode(status)
|
||||
# The following code block is based on
|
||||
# os.waitstatus_to_exitcode() introduced in Python 3.9
|
||||
# and we implement this for comparability with older
|
||||
# versions of Python.
|
||||
if os.WIFSIGNALED(status):
|
||||
return os.WTERMSIG(status)
|
||||
elif os.WIFEXITED(status):
|
||||
return os.WEXITSTATUS(status)
|
||||
elif os.WIFSTOPPED(status):
|
||||
return os.WSTOPSIG(status)
|
||||
else:
|
||||
raise Exception("CRIU was terminated by an "
|
||||
"unidentified reason")
|
||||
except OSError:
|
||||
return -251
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue