mirror of
https://github.com/Mic92/nix-update.git
synced 2024-09-17 13:27:27 +03:00
use .utils.run instead of subprocess.run
This commit is contained in:
parent
0cbea8ba78
commit
350d534ac7
@ -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:
|
||||
|
@ -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")
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user