2
0
mirror of https://github.com/checkpoint-restore/criu synced 2025-08-30 22:05:36 +00:00
Files
criu/test/others/rpc/read.py
Andrei Vagin 5aa72e7237 py: Reformat everything into pep8 style
As discussed on the mailing list, current .py files formatting does not
conform to the world standard, so we should better reformat it. For this
the yapf tool is used. The command I used was

  yapf -i $(find -name *.py)

Signed-off-by: Pavel Emelyanov <xemul@virtuozzo.com>
2019-09-07 15:59:56 +03:00

18 lines
468 B
Python

# This script is used to read a single character from CRIU's status FD.
# That way we know when the CRIU service is ready. CRIU writes a \0 to
# the status FD.
# In theory this could be easily done using 'read -n 1' from bash, but
# but the bash version on Ubuntu has probably the following bug:
# https://lists.gnu.org/archive/html/bug-bash/2017-07/msg00039.html
import sys
f = open(sys.argv[1])
r = f.read(1)
f.close()
if r == '\0':
sys.exit(0)
sys.exit(-1)