summaryrefslogtreecommitdiffstats
path: root/src/lib/Bcfg2/Utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/Bcfg2/Utils.py')
-rw-r--r--src/lib/Bcfg2/Utils.py14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/lib/Bcfg2/Utils.py b/src/lib/Bcfg2/Utils.py
index 7d7d26d5d..33da8bd71 100644
--- a/src/lib/Bcfg2/Utils.py
+++ b/src/lib/Bcfg2/Utils.py
@@ -197,14 +197,20 @@ class Executor(object):
:type timeout: float
:returns: :class:`Bcfg2.Utils.ExecutorResult`
"""
- if isinstance(command, str):
+ if isinstance(command, basestring):
cmdstr = command
else:
cmdstr = " ".join(command)
self.logger.debug("Running: %s" % cmdstr)
- proc = subprocess.Popen(command, shell=shell, bufsize=16384,
- stdin=subprocess.PIPE, stdout=subprocess.PIPE,
- stderr=subprocess.PIPE, close_fds=True)
+ try:
+ proc = subprocess.Popen(command, shell=shell, bufsize=16384,
+ close_fds=True,
+ stdin=subprocess.PIPE,
+ stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ except OSError:
+ return ExecutorResult('', 'No such command: %s' % cmdstr,
+ 127)
if timeout is None:
timeout = self.timeout
if timeout is not None: