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").
@@ -103,7 +103,10 @@ class DaemonState(object):
:param sig: signal to send
"""
if self.running():
+ 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:
