version.py: fix build_id after recent refactors (#1393)

* version.py: fix build_id after recent refactors

* fix lint
pull/1395/head
Disconnect3d 3 years ago committed by GitHub
parent 39ebd66539
commit f01f932755
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -6,8 +6,11 @@ def build_id(): # type: () -> str
"""
Returns pwndbg commit id if git is available.
"""
pwndbg_dir = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
assert os.path.exists(os.path.join(pwndbg_dir, "gdbinit.py"))
try:
git_path = os.path.join(os.path.dirname(os.path.dirname(__file__)), ".git")
git_path = os.path.join(pwndbg_dir, ".git")
cmd = ["git", "--git-dir", git_path, "rev-parse", "--short", "HEAD"]
commit_id = subprocess.check_output(cmd, stderr=subprocess.STDOUT)

Loading…
Cancel
Save