mirror of
https://github.com/checkpoint-restore/criu
synced 2025-09-04 08:15:37 +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:
committed by
Andrei Vagin
parent
733f165512
commit
e4b6fb2d1f
@@ -71,7 +71,19 @@ def _wait_for_process_status(criu_pid):
|
|||||||
try:
|
try:
|
||||||
(pid, status) = os.wait()
|
(pid, status) = os.wait()
|
||||||
if pid == criu_pid:
|
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:
|
except OSError:
|
||||||
return -251
|
return -251
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user