avoid zombie git process

This commit is contained in:
lilydjwg 2014-03-07 21:08:38 +08:00
parent 882ee6ace7
commit 3f21a0672d

View File

@ -787,7 +787,7 @@ def get_version():
try: try:
import subprocess import subprocess
real_dir = os.path.dirname(os.path.realpath(__file__)) real_dir = os.path.dirname(os.path.realpath(__file__))
git_hash = subprocess.Popen(['git', 'rev-parse', '--short', 'HEAD'], cwd=real_dir, stdout=subprocess.PIPE, stderr=subprocess.DEVNULL).stdout.read().decode('utf-8').strip() git_hash = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD'], cwd=real_dir, stderr=subprocess.DEVNULL).decode('utf-8').strip()
assert git_hash assert git_hash
return '%s-%s' % (__version__, git_hash) return '%s-%s' % (__version__, git_hash)
except: except: