From 5e0a74f8ce1b258973c99e49aae5ed2d7409b23a Mon Sep 17 00:00:00 2001 From: Nate Bowman Date: Thu, 8 Oct 2026 18:36:32 -0400 Subject: [PATCH] Check output for curl commands --- website/download.py | 8 +++----- website/helpers.py | 10 ++++++++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/website/download.py b/website/download.py index 18cffaf..3d77107 100644 --- a/website/download.py +++ b/website/download.py @@ -1,7 +1,6 @@ import json import logging import pandas as pd -import subprocess from website import helpers @@ -18,8 +17,7 @@ def _download_max_players() -> None: f" '{config.share['uri']}'" ) - # TODO error check - subprocess.run(cmd, shell=True) + helpers.run_and_log_cmd(cmd) def _download_games(user: str) -> None: @@ -35,8 +33,8 @@ def _download_games(user: str) -> None: f"{STEAM_OPTIONS}" f"&steamid={config.users[user]}'" ) - # TODO error check - subprocess.run(cmd, shell=True) + + helpers.run_and_log_cmd(cmd) def _refresh_games_if_needed(users: list(str), force=False) -> None: diff --git a/website/helpers.py b/website/helpers.py index 55780c2..2181699 100644 --- a/website/helpers.py +++ b/website/helpers.py @@ -2,6 +2,7 @@ import logging import os from markupsafe import escape from pathlib import Path +import subprocess import time from website.config import config @@ -45,3 +46,12 @@ def safely_get_people(unsafe_people: str) -> list(str): return None return safe_users + + +def run_and_log_cmd(cmd): + proc = subprocess.run(cmd, + shell=True, + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) + if proc.returncode != 0: + logger.error(proc.stdout)