also catch OSError from subprocess

Signed-off-by: Nico Schottelius <nico@kr.ethz.ch>
This commit is contained in:
Nico Schottelius 2011-09-18 20:50:07 +02:00
parent 88c1be4b1b
commit a9bcec7fbe

View file

@ -198,6 +198,8 @@ class Cdist:
script_fd.close()
self.exit_error("Command failed (shell): " + " ".join(*args))
except OSError as error:
self.exit_error(" ".join(*args) + ": " + error.args[1])
def run_or_fail(self, *args, **kargs):
if "remote" in kargs:
@ -211,6 +213,9 @@ class Cdist:
subprocess.check_call(*args, **kargs)
except subprocess.CalledProcessError:
self.exit_error("Command failed: " + " ".join(*args))
except OSError as error:
self.exit_error(" ".join(*args) + ": " + error.args[1])
def remove_remote_dir(self, destination):
self.run_or_fail(["rm", "-rf", destination], remote=True)