From 675f10d2712a49a62cd8a172585578e57ada817a Mon Sep 17 00:00:00 2001 From: Clint Byrum Date: Sat, 8 Sep 2018 21:38:01 -0700 Subject: [PATCH] python3: Can't have unbuffered non-binary I/O The console daemon has, thus far, primarily been tested on python2 for various reasons. However, when forcing it to python3 by setting ansible_python_interpreter=/usr/bin/python3, we find that the console daemon explodes because Python 3 does not allow unbuffered I/O on non-binary files. It should be fine to have /dev/null be binary mode, as it is just being used to do low-level fileno() operations, the file ojbect is discarded shortly thereafter. Change-Id: Ib030863c2de17825e29874733fc5a9b023f7a601 --- zuul/ansible/library/zuul_console.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zuul/ansible/library/zuul_console.py b/zuul/ansible/library/zuul_console.py index 6703cc12b9..6f5a86f2b4 100644 --- a/zuul/ansible/library/zuul_console.py +++ b/zuul/ansible/library/zuul_console.py @@ -49,7 +49,7 @@ def daemonize(): sys.stderr.flush() i = open('/dev/null', 'r') o = open('/dev/null', 'a+') - e = open('/dev/null', 'a+', 0) + e = open('/dev/null', 'ab+', 0) os.dup2(i.fileno(), sys.stdin.fileno()) os.dup2(o.fileno(), sys.stdout.fileno()) os.dup2(e.fileno(), sys.stderr.fileno())