From 20959161cd65237a32cc34c877941696e4215f51 Mon Sep 17 00:00:00 2001 From: Wainer dos Santos Moschetta Date: Tue, 13 Mar 2018 18:35:07 -0300 Subject: [PATCH] utils.process: FDDrainer.flush() check stream is open The method flush() in FDDrainer does not check the stream is open before get its file descriptor, resulting in "ValueError: I/O operation on closed file". Changed flush() to check the stream is open, otherwise do not try to flush. Signed-off-by: Wainer dos Santos Moschetta --- avocado/utils/process.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/avocado/utils/process.py b/avocado/utils/process.py index 517e34d9..9a00d632 100644 --- a/avocado/utils/process.py +++ b/avocado/utils/process.py @@ -418,7 +418,7 @@ class FDDrainer(object): # and other logging handlers (custom ones?) also have # the same interface, so let's try to use it if available stream = getattr(handler, 'stream', None) - if stream is not None: + if (stream is not None) and (not stream.closed): os.fsync(stream.fileno()) if hasattr(handler, 'close'): handler.close() -- GitLab