diff --git a/update.py b/update.py index 5448b90..ed504a0 100644 --- a/update.py +++ b/update.py @@ -74,7 +74,8 @@ ZIP_URL = "https://git.armoredarmadillo.com/brockdarnold/eve-watcher/archive/mai def _git(*a): - return subprocess.run(["git", "-C", HERE, *a], capture_output=True, text=True) + env = dict(os.environ, GIT_TERMINAL_PROMPT="0") # never block on an interactive prompt + return subprocess.run(["git", "-C", HERE, *a], capture_output=True, text=True, env=env) def _have_git(): @@ -89,9 +90,11 @@ def update_code(): if _have_git(): before = _git("rev-parse", "HEAD").stdout.strip() if _git("fetch", "-q", "origin").returncode != 0: - print("! git fetch failed (offline?). Keeping current version.") - return False - _git("reset", "--hard", "-q", "origin/main") + print("! git fetch failed — falling back to zip update.") + return _zip_update() + if _git("reset", "--hard", "-q", "origin/main").returncode != 0: + print("! git reset failed (locked .git pack?) — falling back to zip update.") + return _zip_update() # zip writes files directly, no .git pack to unlink after = _git("rev-parse", "HEAD").stdout.strip() if before and after and before != after: print(f" updated: {before[:7]} -> {after[:7]}")