generated from coulomb/repo-seed
ui improvements on error when registering repos
This commit is contained in:
@@ -63,14 +63,20 @@ class GitIngestionService:
|
||||
def _run_git(self, args: list[str], *, cwd: Path | None) -> None:
|
||||
if shutil.which("git") is None:
|
||||
raise RuntimeError("git executable was not found")
|
||||
result = subprocess.run(
|
||||
["git", *args],
|
||||
cwd=cwd,
|
||||
check=False,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=120,
|
||||
)
|
||||
command = ["git", *args]
|
||||
try:
|
||||
result = subprocess.run(
|
||||
command,
|
||||
cwd=cwd,
|
||||
check=False,
|
||||
capture_output=True,
|
||||
text=True,
|
||||
timeout=120,
|
||||
)
|
||||
except subprocess.TimeoutExpired as exc:
|
||||
raise RuntimeError(
|
||||
f"git {' '.join(args)} timed out after {exc.timeout} seconds"
|
||||
) from exc
|
||||
if result.returncode != 0:
|
||||
message = result.stderr.strip() or result.stdout.strip()
|
||||
raise RuntimeError(f"git {' '.join(args)} failed: {message}")
|
||||
|
||||
Reference in New Issue
Block a user