From a906ebbd96cf3a022b489cc2c6aa1136e3c35af2 Mon Sep 17 00:00:00 2001 From: "Chris St. Pierre" Date: Fri, 22 Mar 2013 09:05:16 -0400 Subject: Executor: handle missing commands in a more backwards-compatible way --- src/lib/Bcfg2/Utils.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src/lib/Bcfg2/Utils.py') diff --git a/src/lib/Bcfg2/Utils.py b/src/lib/Bcfg2/Utils.py index 4e2deb92e..33da8bd71 100644 --- a/src/lib/Bcfg2/Utils.py +++ b/src/lib/Bcfg2/Utils.py @@ -202,9 +202,15 @@ class Executor(object): 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: -- cgit v1.2.3-1-g7c22