stg mail: factor out __update_header
[stgit] / stgit / run.py
index 7493ed3..2d8ed34 100644 (file)
@@ -110,7 +110,11 @@ class Run:
                                  stdin = subprocess.PIPE,
                                  stdout = subprocess.PIPE,
                                  stderr = subprocess.PIPE)
-            outdata, errdata = p.communicate(self.__indata)
+            # TODO: only use communicate() once support for Python 2.4 is
+            # dropped (write() needed because of performance reasons)
+            if self.__indata:
+                p.stdin.write(self.__indata)
+            outdata, errdata = p.communicate()
             self.exitcode = p.returncode
         except OSError, e:
             raise self.exc('%s failed: %s' % (self.__cmd[0], e))