Skip to content

Commit

Permalink
Merge pull request #116 from radarhere/dater
Browse files Browse the repository at this point in the history
  • Loading branch information
hugovk committed Apr 24, 2024
2 parents 3500334 + ccf1efb commit c0678ed
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions docs/dater.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from __future__ import annotations

import datetime as dt
import os
import re
import subprocess
from typing import TYPE_CHECKING
Expand All @@ -22,11 +21,10 @@
def get_date_for(git_version: str) -> dt.datetime | None:
cmd = ["git", "log", "-1", "--format=%ai", git_version]
try:
with open(os.devnull, "w", encoding="utf-8") as devnull:
out = subprocess.check_output(
cmd, stderr=devnull, text=True, encoding="utf-8"
)
ts = out.strip()
out = subprocess.check_output(
cmd, stderr=subprocess.DEVNULL, text=True, encoding="utf-8"
)
ts = out.strip()
return dt.datetime.fromisoformat(ts)
except subprocess.CalledProcessError:
return None
Expand Down

0 comments on commit c0678ed

Please sign in to comment.