[meld] Adjust _vc.call() to explicitly discard all subprocess output



commit 694e35a50339ee49a48e868ccac64f388a508b5a
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Wed Dec 12 07:04:26 2012 +1000

    Adjust _vc.call() to explicitly discard all subprocess output
    
    Since call() should only ever be used to check the return value of a
    command, there's no point asking for a pipe to the output. In fact,
    asking for a pipe causes issues when the output exceeds the internal
    buffers and stalls. This patch remedies both the semantic and practical
    problem by explicitly dropping stdout and stderr into os.devnull.

 meld/vc/_vc.py |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/meld/vc/_vc.py b/meld/vc/_vc.py
index ef556b0..eddb8f3 100644
--- a/meld/vc/_vc.py
+++ b/meld/vc/_vc.py
@@ -253,7 +253,8 @@ class InvalidVCRevision(ValueError):
 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,
-                           stderr=subprocess.STDOUT)
+    NULL = open(os.devnull, "wb")
+    return subprocess.call(cmd, cwd=cwd, stdout=NULL, stderr=NULL)



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