From 9388320db3fbc7972b7f5ae026728f687f3a357e Mon Sep 17 00:00:00 2001 From: coolkiid <73600915+coolkiid@users.noreply.github.com> Date: Mon, 9 Sep 2024 19:30:05 +0800 Subject: [PATCH] optimize: print original error if 'tasklist' fails printing the original error may be helpful for troubleshooting issues like #456 and #367. --- app/common/util.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/app/common/util.py b/app/common/util.py index 9da7321..368797c 100644 --- a/app/common/util.py +++ b/app/common/util.py @@ -155,8 +155,18 @@ def getLolClientPid(path): def getLolClientPids(path): - processes = subprocess.check_output( - f'{path} /FI "imagename eq LeagueClientUx.exe" /NH', shell=True) + try: + processes = subprocess.check_output( + f'{path} /FI "imagename eq LeagueClientUx.exe" /NH', + shell=True, + stderr=subprocess.STDOUT + ) + except subprocess.CalledProcessError as e: + logger.error( + 'an error occurred when calling tasklist command, ' + f'original output: {e.output.decode()}' + ) + raise e pids = []