Fix type warning for pipe.stdout possibly being None

Add conditional check before calling .read() on pipe.stdout since
Popen can return None for stdout.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Simon Willison 2025-12-16 16:22:07 -08:00
commit cb172edca0

View file

@ -79,7 +79,7 @@ author = "Simon Willison"
#
# The short X.Y version.
pipe = Popen("git describe --tags --always", stdout=PIPE, shell=True)
git_version = pipe.stdout.read().decode("utf8")
git_version = pipe.stdout.read().decode("utf8") if pipe.stdout else ""
if git_version:
version = git_version.rsplit("-", 1)[0]