use .utils.run instead of subprocess.run

This commit is contained in:
figsoda 2022-11-17 12:49:14 -05:00
parent 0cbea8ba78
commit 350d534ac7
2 changed files with 4 additions and 5 deletions

View File

@ -1,7 +1,8 @@
import re
import subprocess
from typing import Optional
from .utils import run
def old_version_from_diff(
diff: str, linenumber: int, new_version: str
@ -37,10 +38,8 @@ def old_version_from_diff(
def old_version_from_git(
filename: str, linenumber: int, new_version: str
) -> Optional[str]:
proc = subprocess.run(
proc = run(
["git", "diff", "--color=never", "--word-diff=porcelain", "--", filename],
text=True,
stdout=subprocess.PIPE,
)
assert proc.stdout is not None
if len(proc.stdout) == 0:

View File

@ -54,7 +54,7 @@ def to_sri(hashstr: str) -> str:
"to-sri",
f"{prefix}{hashstr}",
]
proc = subprocess.run(cmd, stdout=subprocess.PIPE, check=True, text=True)
proc = run(cmd)
return proc.stdout.rstrip("\n")