fix #125: handle 'git log' failures gracefully
This commit is contained in:
parent
5e21e1b7b5
commit
d1a9309b03
|
@ -8,13 +8,15 @@ socket.setdefaulttimeout(10) # global setting
|
||||||
|
|
||||||
|
|
||||||
def get_version():
|
def get_version():
|
||||||
p = subprocess.Popen(['git', 'log', '--oneline'], stdout=subprocess.PIPE)
|
try:
|
||||||
stdout, _ = p.communicate()
|
stdout = subprocess.check_output(['git', 'log', '--format=%h'])
|
||||||
p.wait()
|
except:
|
||||||
|
revnumber = 0
|
||||||
revnumber = len(stdout.splitlines())
|
shorthash = '????'
|
||||||
|
else:
|
||||||
shorthash = stdout.split(None, 1)[0]
|
revs = stdout.splitlines()
|
||||||
|
revnumber = len(revs)
|
||||||
|
shorthash = revs[0]
|
||||||
|
|
||||||
http.ua_skybot = 'Skybot/r%d %s (http://github.com/rmmh/skybot)' \
|
http.ua_skybot = 'Skybot/r%d %s (http://github.com/rmmh/skybot)' \
|
||||||
% (revnumber, shorthash)
|
% (revnumber, shorthash)
|
||||||
|
|
Loading…
Reference in New Issue