[meld] _vc.py: Add a call() function



commit 90a1174db5844be5374f0f82df2943566e8c3048
Author: Peter Tyser <ptyser gmail com>
Date:   Tue Aug 17 23:47:57 2010 -0500

    _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>

 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)



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