From a573f1011f483e7a224bb64df00dd51b80348c1f Mon Sep 17 00:00:00 2001 From: vagrant Date: Fri, 19 May 2017 08:12:31 +0000 Subject: [PATCH] Used splitlines instead of split('\n') because the latter returns a leading empty string if the input ends with a newline. This resulted in spurious empty lines in log because of the buffering. --- supervisor_stdout.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/supervisor_stdout.py b/supervisor_stdout.py index b1ae219..d068ef5 100644 --- a/supervisor_stdout.py +++ b/supervisor_stdout.py @@ -19,7 +19,7 @@ def main(): def event_handler(event, response): line, data = response.split('\n', 1) headers = dict([ x.split(':') for x in line.split() ]) - lines = data.split('\n') + lines = data.splitlines() prefix = '%s %s | '%(headers['processname'], headers['channel']) print '\n'.join([ prefix + l for l in lines ])