Blame SOURCES/sos-bz2079486-timeouted-exec-cmd-exception.patch

904e70
From 5e27b92a8a9f066af4c41ddd0bedc7c69187ff52 Mon Sep 17 00:00:00 2001
904e70
From: Pavel Moravec <pmoravec@redhat.com>
904e70
Date: Mon, 2 May 2022 22:13:34 +0200
904e70
Subject: [PATCH] [utilities] Close file only when storing to file
904e70
904e70
Call _output.close() only when to_file=true.
904e70
904e70
Closes: #2925
904e70
904e70
Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
904e70
---
904e70
 sos/utilities.py | 3 ++-
904e70
 1 file changed, 2 insertions(+), 1 deletion(-)
904e70
904e70
diff --git a/sos/utilities.py b/sos/utilities.py
904e70
index d2f73d86..1075d1d4 100644
904e70
--- a/sos/utilities.py
904e70
+++ b/sos/utilities.py
904e70
@@ -212,7 +212,8 @@ def sos_get_command_output(command, timeout=TIMEOUT_DEFAULT, stderr=False,
904e70
                 p.wait(timeout if timeout else None)
904e70
             except Exception:
904e70
                 p.terminate()
904e70
-                _output.close()
904e70
+                if to_file:
904e70
+                    _output.close()
904e70
                 # until we separate timeouts from the `timeout` command
904e70
                 # handle per-cmd timeouts via Plugin status checks
904e70
                 return {'status': 124, 'output': reader.get_contents(),
904e70
-- 
904e70
2.34.3
904e70