mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 02:14:37 +00:00
test/criu-ns: drop python 2 compatibility
This patch is replacing the set_blocking() function with os.set_blocking(). This function was introduced for compatibility with Python 2 in commit 8094df8di (criu-ns: Add tests for criu-ns script). Signed-off-by: Radostin Stoyanov <rstoyanov@fedoraproject.org>
This commit is contained in:
parent
ede018176c
commit
ee9983d4a9
1 changed files with 1 additions and 14 deletions
|
|
@ -25,19 +25,6 @@ def check_dumpdir(path=IMG_DIR):
|
|||
os.mkdir(path, 0o755)
|
||||
|
||||
|
||||
def set_blocking(fd, blocking):
|
||||
"""Implement os.set_blocking() for compatibility with Python
|
||||
versions earlier than 3.5"""
|
||||
flags = fcntl.fcntl(fd, fcntl.F_GETFL)
|
||||
|
||||
if blocking:
|
||||
flags &= ~os.O_NONBLOCK
|
||||
else:
|
||||
flags |= os.O_NONBLOCK
|
||||
|
||||
fcntl.fcntl(fd, fcntl.F_SETFL, flags)
|
||||
|
||||
|
||||
def run_task_with_own_pty(task):
|
||||
fd_m, fd_s = pty.openpty()
|
||||
|
||||
|
|
@ -55,7 +42,7 @@ def run_task_with_own_pty(task):
|
|||
|
||||
os.close(fd_s)
|
||||
fd_m = os.fdopen(fd_m, "rb")
|
||||
set_blocking(fd_m.fileno(), False)
|
||||
os.set_blocking(fd_m.fileno(), False)
|
||||
|
||||
while True:
|
||||
try:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue