From a6df067eb6fcccd25ab71ba3b6fcf83daca340ce Mon Sep 17 00:00:00 2001 From: Jos Collin Date: Wed, 3 Jul 2019 18:15:55 +0530 Subject: [PATCH] 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 --- teuthology/orchestra/daemon/state.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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: -- 2.47.3