We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 43aa314 commit a339f3bCopy full SHA for a339f3b
1 file changed
src/pkgdev/git.py
@@ -1,3 +1,4 @@
1
+import os
2
import subprocess
3
import sys
4
@@ -12,6 +13,7 @@ def run(*args, **kwargs):
12
13
"""Wrapper for running git via subprocess.run()."""
14
kwargs.setdefault("check", True)
15
kwargs.setdefault("text", True)
16
+ kwargs.setdefault("env", os.environ.copy())["PKGDEV"] = "1"
17
cmd = ["git"] + list(args)
18
19
# output git command that would be run to stderr
@@ -21,7 +23,7 @@ def run(*args, **kwargs):
21
23
22
24
try:
25
return subprocess.run(cmd, **kwargs)
- except FileNotFoundError as e:
- raise UserException(str(e))
26
- except subprocess.CalledProcessError as e:
27
- raise GitError(e.returncode)
+ except FileNotFoundError as exc:
+ raise UserException(str(exc))
28
+ except subprocess.CalledProcessError as exc:
29
+ raise GitError(exc.returncode)
0 commit comments