Skip to content

Commit 46d621b

Browse files
author
Przemyslaw Kudriawcew
committed
Change subprocess usage
1 parent 481b559 commit 46d621b

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

.pre-commit-config.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/Kudrixon/pre-commit_hook_static_path
3-
rev: v1.1.2-beta
3+
rev: v1.2.1-beta
44
hooks:
55
- id: check-static-path
66
args: ['--keywords', '/home/tester', '/home/vtest', '--']

pre_commit_hooks/check_static_path.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ def findStringInRangeForFile(filename, keywords, changes_range):
3030
def findStringInRange(filenames, keywords):
3131
results = []
3232
for filename in filenames:
33-
text = subprocess.run(['git', 'diff', "--unified=0", 'HEAD', filename], capture_output=True, text=True).stdout
33+
text = subprocess.check_output(['git', 'diff', "--unified=0", 'HEAD', filename], universal_newlines=True)
3434
matches = extractMatches(text, pattern)
3535
changes_range = []
3636
for s in matches:
@@ -95,4 +95,4 @@ def main(argv: Union[Sequence[str], None] = None) -> int:
9595
return retval
9696

9797
if __name__ == '__main__':
98-
raise SystemExit(main())
98+
raise SystemExit(main())

0 commit comments

Comments
 (0)