\r does not round-trip the local socket, escape and restore on the other side (#43507)

pull/43546/head
Nathaniel Case 6 years ago committed by GitHub
parent c4591f0861
commit 9169daa326
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -214,6 +214,8 @@ def main():
raise Exception("EOF found before vars data was complete") raise Exception("EOF found before vars data was complete")
vars_data += cur_line vars_data += cur_line
cur_line = stdin.readline() cur_line = stdin.readline()
# restore escaped loose \r characters
vars_data = vars_data.replace(br'\r', b'\r')
if PY3: if PY3:
pc_data = cPickle.loads(init_data, encoding='bytes') pc_data = cPickle.loads(init_data, encoding='bytes')

@ -936,6 +936,8 @@ class TaskExecutor:
stdin.write(b'\n#END_INIT#\n') stdin.write(b'\n#END_INIT#\n')
src = cPickle.dumps(variables, protocol=0) src = cPickle.dumps(variables, protocol=0)
# remaining \r fail to round-trip the socket
src = src.replace(b'\r', br'\r')
stdin.write(src) stdin.write(src)
stdin.write(b'\n#END_VARS#\n') stdin.write(b'\n#END_VARS#\n')

Loading…
Cancel
Save