Skip to content

Commit

Permalink
criu-ns: Add support for older Python version in CI
Browse files Browse the repository at this point in the history
These changes remove and update the changes introduced in
7177938 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>
  • Loading branch information
warusadura authored and avagin committed Jun 12, 2023
1 parent b30ecf0 commit 29967dd
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion scripts/criu-ns
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 29967dd

Please sign in to comment.