From: Jos Collin Date: Wed, 3 Jul 2019 12:45:55 +0000 (+0530) Subject: teuthology/orchestra/daemon: Check if stdin is valid X-Git-Tag: 1.1.0~239^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=a6df067eb6fcccd25ab71ba3b6fcf83daca340ce;p=teuthology.git teuthology/orchestra/daemon: Check if stdin is valid As there is self.proc.stdin.close() in stop(), there are chances of write failing with IOError("File is closed"). Signed-off-by: Jos Collin --- diff --git a/teuthology/orchestra/daemon/state.py b/teuthology/orchestra/daemon/state.py index 66a22fd87..4017abc81 100644 --- a/teuthology/orchestra/daemon/state.py +++ b/teuthology/orchestra/daemon/state.py @@ -103,7 +103,10 @@ class DaemonState(object): :param sig: signal to send """ if self.running(): - self.proc.stdin.write(struct.pack('!b', sig)) + try: + self.proc.stdin.write(struct.pack('!b', sig)) + except IOError as e: + log.exception('Failed to send signal %d: %s', sig, e.strerror) if not silent: self.log.info('Sent signal %d', sig) else: