Skip to content

Commit 4dcc3de

Browse files
committed
Fix length calculation in protocol
The data is read as bytes, to the length in the response needs to be calculated in bytes and not in chars.
1 parent 87632a7 commit 4dcc3de

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

supervisor_stdout.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ def main():
1515
line = sys.stdin.readline() # read header line from stdin
1616
headers = dict([ x.split(':') for x in line.split() ])
1717
data = sys.stdin.read(int(headers['len'])) # read the event payload
18-
write_stdout('RESULT %s\n%s'%(len(data), data)) # transition from READY to ACKNOWLEDGED
18+
write_stdout('RESULT %s\n%s'%(len(data.encode("utf-8")), data)) # transition from READY to ACKNOWLEDGED
1919

2020
def event_handler(event, response):
2121
line, data = response.split('\n', 1)

0 commit comments

Comments
 (0)