changeset 2760:fd5f2b217488 beta

get stderr also for git commands, pass in shell = False
author Marcin Kuzminski <marcin@python-works.com>
date Thu, 30 Aug 2012 00:03:48 +0200
parents c61c2ccea2b4
children e64c64e2b8aa
files rhodecode/lib/subprocessio.py rhodecode/lib/vcs/backends/git/repository.py
diffstat 2 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/rhodecode/lib/subprocessio.py	Wed Aug 29 01:07:21 2012 +0200
+++ b/rhodecode/lib/subprocessio.py	Thu Aug 30 00:03:48 2012 +0200
@@ -341,9 +341,10 @@
         if isinstance(cmd, (list, tuple)):
             cmd = ' '.join(cmd)
 
+        _shell = kwargs.get('shell') or True
+        kwargs['shell'] = _shell
         _p = subprocess.Popen(cmd,
             bufsize=-1,
-            shell=True,
             stdin=inputstream,
             stdout=subprocess.PIPE,
             stderr=subprocess.PIPE,
--- a/rhodecode/lib/vcs/backends/git/repository.py	Wed Aug 29 01:07:21 2012 +0200
+++ b/rhodecode/lib/vcs/backends/git/repository.py	Thu Aug 30 00:03:48 2012 +0200
@@ -115,6 +115,7 @@
         try:
             opts = dict(
                 env=gitenv,
+                shell=False,
             )
             if os.path.isdir(self.path):
                 opts['cwd'] = self.path
@@ -124,9 +125,7 @@
             raise RepositoryError("Couldn't run git command (%s).\n"
                                   "Original error was:%s" % (cmd, err))
 
-        so = ''.join(p)
-        se = None
-        return so, se
+        return ''.join(p.output), ''.join(p.error)
 
     @classmethod
     def _check_url(cls, url):