mirror of
https://github.com/checkpoint-restore/criu.git
synced 2026-01-23 02:14:37 +00:00
lib: also handle extra pipe data correctly
CI sometimes errors out encoding/decoding extra pipe data. This should fix extra pipe data for Python 3 and still keep it working on Python 2. Signed-off-by: Adrian Reber <areber@redhat.com>
This commit is contained in:
parent
bf9e502c6f
commit
13e6e68998
1 changed files with 10 additions and 4 deletions
|
|
@ -311,10 +311,13 @@ class pipes_data_extra_handler:
|
|||
def load(self, f, pload):
|
||||
size = pload.bytes
|
||||
data = f.read(size)
|
||||
return base64.encodebytes(data)
|
||||
return base64.encodebytes(data).decode()
|
||||
|
||||
def dump(self, extra, f, pload):
|
||||
data = base64.decodebytes(extra)
|
||||
if (sys.version_info > (3, 0)):
|
||||
data = base64.decodebytes(str.encode(extra))
|
||||
else:
|
||||
data = base64.decodebytes(extra)
|
||||
f.write(data)
|
||||
|
||||
def skip(self, f, pload):
|
||||
|
|
@ -326,10 +329,13 @@ class sk_queues_extra_handler:
|
|||
def load(self, f, pload):
|
||||
size = pload.length
|
||||
data = f.read(size)
|
||||
return base64.encodebytes(data)
|
||||
return base64.encodebytes(data).decode()
|
||||
|
||||
def dump(self, extra, f, _unused):
|
||||
data = base64.decodebytes(extra)
|
||||
if (sys.version_info > (3, 0)):
|
||||
data = base64.decodebytes(str.encode(extra))
|
||||
else:
|
||||
data = base64.decodebytes(extra)
|
||||
f.write(data)
|
||||
|
||||
def skip(self, f, pload):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue