1
0
forked from rpms/sos
sos/sos-bz2079492-timeouted-exec-cmd-exception.patch
Pavel Moravec a2c404f3a7 sos updates to 9.1
Plus removed 9.0 patchfiles

Resolves: bz2065563 bz2066181 bz2079188 bz2079490
Resolves: bz2079491 bz2079492 bz2082914 bz2095267
Resolves: bz2097674

Signed-off-by: Pavel Moravec <pmoravec@redhat.com>
2022-06-16 23:09:06 +02:00

32 lines
1.0 KiB
Diff

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