aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--libbe/arch.py6
-rw-r--r--libbe/rcs.py16
2 files changed, 15 insertions, 7 deletions
diff --git a/libbe/arch.py b/libbe/arch.py
index 624aea3..038325a 100644
--- a/libbe/arch.py
+++ b/libbe/arch.py
@@ -24,7 +24,11 @@ if client is None:
config.set_val("arch_client", client)
def invoke(args):
- q = Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE)
+ try :
+ q = Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE)
+ except OSError, e :
+ strerror = "%s\nwhile executing %s" % (e.args[1], args)
+ raise Exception("Command failed: %s" % strerror)
output = q.stdout.read()
error = q.stderr.read()
status = q.wait()
diff --git a/libbe/rcs.py b/libbe/rcs.py
index 77d6c9a..4487fba 100644
--- a/libbe/rcs.py
+++ b/libbe/rcs.py
@@ -59,12 +59,16 @@ class CommandError(Exception):
self.status = status
def invoke(args, expect=(0,), cwd=None):
- if sys.platform != "win32":
- q = Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE, cwd=cwd)
- else:
- # win32 don't have os.execvp() so have to run command in a shell
- q = Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE, shell=True,
- cwd=cwd)
+ try :
+ if sys.platform != "win32":
+ q = Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE, cwd=cwd)
+ else:
+ # win32 don't have os.execvp() so have to run command in a shell
+ q = Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE, shell=True,
+ cwd=cwd)
+ except OSError, e :
+ strerror = "%s\nwhile executing %s" % (e.args[1], args)
+ raise CommandError(strerror, e.args[0])
output, error = q.communicate()
status = q.wait()
if status not in expect: