aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBryn M. Reeves <bmr@redhat.com>2014-04-06 18:17:28 +0100
committerBryn M. Reeves <bmr@redhat.com>2014-04-06 18:17:28 +0100
commit79140bcd17efe5db40328d5d8b975aa68b6e2128 (patch)
tree9e1e0aad390f236b628ac69cc2b2ce5b37b8477d
parent46b6c3d39f923d19fa7fcfec96c1cf2d23c768be (diff)
downloadsos-79140bcd17efe5db40328d5d8b975aa68b6e2128.tar.gz
Handle ENOENT in sos_get_command_output()
Signed-off-by: Bryn M. Reeves <bmr@redhat.com>
-rw-r--r--sos/utilities.py9
1 files changed, 8 insertions, 1 deletions
diff --git a/sos/utilities.py b/sos/utilities.py
index d3115f84..edcc0ed5 100644
--- a/sos/utilities.py
+++ b/sos/utilities.py
@@ -34,6 +34,7 @@ import tarfile
import hashlib
import logging
import fnmatch
+import errno
import shlex
from contextlib import closing
@@ -146,9 +147,15 @@ def sos_get_command_output(command, timeout=300, runat=None):
command = "timeout %ds %s" % (timeout, command)
args = shlex.split(command)
- p = Popen(args, shell=False, stdout=PIPE, stderr=STDOUT,
+ try:
+ p = Popen(args, shell=False, stdout=PIPE, stderr=STDOUT,
bufsize=-1, env = cmd_env, close_fds = True,
preexec_fn=_child_chdir)
+ except OSError as e:
+ if e.errno == errno.ENOENT:
+ return {'status': 127, 'output': ""}
+ else:
+ raise e
stdout, stderr = p.communicate()