Check output for curl commands
This commit is contained in:
@@ -1,7 +1,6 @@
|
|||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import pandas as pd
|
import pandas as pd
|
||||||
import subprocess
|
|
||||||
|
|
||||||
from website import helpers
|
from website import helpers
|
||||||
|
|
||||||
@@ -18,8 +17,7 @@ def _download_max_players() -> None:
|
|||||||
f" '{config.share['uri']}'"
|
f" '{config.share['uri']}'"
|
||||||
)
|
)
|
||||||
|
|
||||||
# TODO error check
|
helpers.run_and_log_cmd(cmd)
|
||||||
subprocess.run(cmd, shell=True)
|
|
||||||
|
|
||||||
|
|
||||||
def _download_games(user: str) -> None:
|
def _download_games(user: str) -> None:
|
||||||
@@ -35,8 +33,8 @@ def _download_games(user: str) -> None:
|
|||||||
f"{STEAM_OPTIONS}"
|
f"{STEAM_OPTIONS}"
|
||||||
f"&steamid={config.users[user]}'"
|
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:
|
def _refresh_games_if_needed(users: list(str), force=False) -> None:
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ import logging
|
|||||||
import os
|
import os
|
||||||
from markupsafe import escape
|
from markupsafe import escape
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
import subprocess
|
||||||
import time
|
import time
|
||||||
|
|
||||||
from website.config import config
|
from website.config import config
|
||||||
@@ -45,3 +46,12 @@ def safely_get_people(unsafe_people: str) -> list(str):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
return safe_users
|
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)
|
||||||
|
|||||||
Reference in New Issue
Block a user