aboutsummaryrefslogtreecommitdiffstats
path: root/libbe/rcs.py
diff options
context:
space:
mode:
Diffstat (limited to 'libbe/rcs.py')
-rw-r--r--libbe/rcs.py11
1 files changed, 6 insertions, 5 deletions
diff --git a/libbe/rcs.py b/libbe/rcs.py
index 549691a..1c12068 100644
--- a/libbe/rcs.py
+++ b/libbe/rcs.py
@@ -46,14 +46,15 @@ class CommandError(Exception):
self.err_str = err_str
self.status = status
-def invoke(args, expect=(0,)):
+def invoke(args, expect=(0,), cwd=None):
+ q = Popen(args, stdout=PIPE, stderr=PIPE, cwd=cwd)
if sys.platform != "win32":
- q = Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE)
+ 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)
- output = q.stdout.read()
- error = q.stderr.read()
+ q = Popen(args, stdin=PIPE, stdout=PIPE, stderr=PIPE, shell=True,
+ cwd=cwd)
+ output, error = q.communicate()
status = q.wait()
if status not in expect:
raise CommandError(error, status)