[PATCH v2 1/3] _vc.py: Add a call() function



This is similar to the popen() function that is already implemented in
_vc.py, but it returns a called function's return code whereas popen()
returns the stdout output.

Signed-off-by: Peter Tyser <ptyser gmail com>
---
Note: these 3 patches attempt to fix the issue mentioned by Eric and Kai at
http://mail.gnome.org/archives/meld-list/2010-June/msg00033.html

 meld/vc/_vc.py |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/meld/vc/_vc.py b/meld/vc/_vc.py
index 413e072..27844d6 100644
--- a/meld/vc/_vc.py
+++ b/meld/vc/_vc.py
@@ -200,6 +200,10 @@ class CachedVc(Vc):
             self.cache_inventory(directory)
         return self._tree_cache
 
+# Return the stdout output of a given command
 def popen(cmd, cwd=None):
     return subprocess.Popen(cmd, cwd=cwd, stdout=subprocess.PIPE).stdout
 
+# Return the return value of a given command
+def call(cmd, cwd=None):
+    return subprocess.call(cmd, cwd=cwd, stdout=subprocess.PIPE)
-- 
1.7.1.13.gcfb88



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]