Blame SOURCES/sos-bz971420-strip-trailing-newline.patch
|
|
6b17e9 |
commit dc1e011f3035646c81b54c265dff638ffe282ff1
|
|
|
6b17e9 |
Author: Bryn M. Reeves <bmr@redhat.com>
|
|
|
6b17e9 |
Date: Tue Aug 6 21:53:41 2013 +0100
|
|
|
6b17e9 |
|
|
|
6b17e9 |
Strip trailing newline from command output
|
|
|
6b17e9 |
|
|
|
6b17e9 |
This commit brings sos-3.x behaviour into line with earlier
|
|
|
6b17e9 |
releases and produces captured command output that is consistent
|
|
|
6b17e9 |
with typical shell redirection use.
|
|
|
6b17e9 |
|
|
|
6b17e9 |
Resolves: bz971420
|
|
|
6b17e9 |
|
|
|
6b17e9 |
diff --git a/sos/utilities.py b/sos/utilities.py
|
|
|
6b17e9 |
index fcc78c5..4279b12 100644
|
|
|
6b17e9 |
--- a/sos/utilities.py
|
|
|
6b17e9 |
+++ b/sos/utilities.py
|
|
|
6b17e9 |
@@ -161,6 +161,8 @@ def sos_get_command_output(command, timeout=300):
|
|
|
6b17e9 |
stdout=PIPE, stderr=STDOUT,
|
|
|
6b17e9 |
bufsize=-1, env = cmd_env)
|
|
|
6b17e9 |
stdout, stderr = p.communicate()
|
|
|
6b17e9 |
+ # hack to delete trailing '\n' added by p.communicate()
|
|
|
6b17e9 |
+ if stdout[-1:] == '\n': stdout = stdout[:-1]
|
|
|
6b17e9 |
return (p.returncode, stdout, 0)
|
|
|
6b17e9 |
else:
|
|
|
6b17e9 |
return (127, "", 0)
|