aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Fischer <florian.fischer@muhq.space>2023-07-17 22:28:53 +0200
committerFlorian Fischer <florian.fischer@muhq.space>2023-07-17 22:28:53 +0200
commit89cf7c5c14becb6ebfc682932dadf1e5697b2675 (patch)
tree6a9ed6d37acb912a4becca87e6e8da8a6712b5ac
parent69f0a5bfbf09adad59dd123b371ff489b0772fe7 (diff)
downloadquiz-89cf7c5c14becb6ebfc682932dadf1e5697b2675.tar.gz
quiz-89cf7c5c14becb6ebfc682932dadf1e5697b2675.zip
build the command arrays directly without string splitting
-rwxr-xr-xquiz.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/quiz.py b/quiz.py
index b7bad61..d6c6a21 100755
--- a/quiz.py
+++ b/quiz.py
@@ -43,7 +43,8 @@ def err(msg: str, status=1):
def play_sound(sound: Path):
"""Play a sound file"""
- subprocess.run(f'{PLAY_SOUND_CMD} "{sound}"'.split(),
+ cmd = PLAY_SOUND_CMD.split() + [str(sound)]
+ subprocess.run(cmd,
check=True,
stderr=subprocess.DEVNULL,
stdout=subprocess.DEVNULL)
@@ -147,7 +148,7 @@ def load_solutions(question_dirs: list[Path],
def show_question(question: Path) -> subprocess.Popen:
"""show the question in an external programm and return the process"""
- cmd = f'{SHOW_QUESTION_CMD} "{question}"'.split()
+ cmd = SHOW_QUESTION_CMD.split() + [str(question)]
return subprocess.Popen(cmd, shell=True)