##// END OF EJS Templates
--version command should be safe, and bare no modifications...
marcink -
r3397:64c19449 beta
parent child Browse files
Show More
@@ -119,7 +119,11 b' class InputStreamChunker(Thread):'
119 119 kr = self.keep_reading
120 120 da = self.data_added
121 121 go = self.go
122 b = s.read(cs)
122
123 try:
124 b = s.read(cs)
125 except ValueError:
126 b = ''
123 127
124 128 while b and go.is_set():
125 129 if len(t) > ccm:
@@ -372,7 +376,9 b' class SubprocessIOChunker(object):'
372 376 bg_out.stop()
373 377 bg_err.stop()
374 378 err = '%s' % ''.join(bg_err)
375 raise EnvironmentError("Subprocess exited due to an error:\n" + err)
379 if err:
380 raise EnvironmentError("Subprocess exited due to an error:\n" + err)
381 raise EnvironmentError("Subprocess exited with non 0 ret code:%s" % _returncode)
376 382
377 383 self.process = _p
378 384 self.output = bg_out
@@ -748,7 +748,8 b' def check_git_version():'
748 748 from rhodecode.lib.vcs.backends.git.repository import GitRepository
749 749 from distutils.version import StrictVersion
750 750
751 stdout, stderr = GitRepository._run_git_command('--version')
751 stdout, stderr = GitRepository._run_git_command('--version', _bare=True,
752 _safe=True)
752 753
753 754 ver = (stdout.split(' ')[-1] or '').strip() or '0.0.0'
754 755 if len(ver.split('.')) > 3:
@@ -102,7 +102,17 b' class GitRepository(BaseRepository):'
102 102 :param opts: env options to pass into Subprocess command
103 103 """
104 104
105 _copts = ['-c', 'core.quotepath=false', ]
105 if '_bare' in opts:
106 _copts = []
107 del opts['_bare']
108 else:
109 _copts = ['-c', 'core.quotepath=false', ]
110 safe_call = False
111 if '_safe' in opts:
112 #no exc on failure
113 del opts['_safe']
114 safe_call = True
115
106 116 _str_cmd = False
107 117 if isinstance(cmd, basestring):
108 118 cmd = [cmd]
@@ -126,9 +136,13 b' class GitRepository(BaseRepository):'
126 136 _opts.update(opts)
127 137 p = subprocessio.SubprocessIOChunker(cmd, **_opts)
128 138 except (EnvironmentError, OSError), err:
129 log.error(traceback.format_exc())
130 raise RepositoryError("Couldn't run git command (%s).\n"
131 "Original error was:%s" % (cmd, err))
139 tb_err = ("Couldn't run git command (%s).\n"
140 "Original error was:%s\n" % (cmd, err))
141 log.error(tb_err)
142 if safe_call:
143 return '', err
144 else:
145 raise RepositoryError(tb_err)
132 146
133 147 return ''.join(p.output), ''.join(p.error)
134 148
General Comments 0
You need to be logged in to leave comments. Login now