From 4bacc26adf67cac4a9d6132623a5c403e44222e1 Mon Sep 17 00:00:00 2001 From: R1kaB3rN <100738684+R1kaB3rN@users.noreply.github.com> Date: Sun, 2 Jun 2024 11:31:03 -0700 Subject: [PATCH] umu_util: do not use single with block - Related to https://github.com/lutris/lutris/issues/5434 --- umu/umu_util.py | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/umu/umu_util.py b/umu/umu_util.py index 30def6be5..77e94ef0a 100644 --- a/umu/umu_util.py +++ b/umu/umu_util.py @@ -29,13 +29,14 @@ def run_zenity(command: str, opts: list[str], msg: str) -> int: return -1 # Communicate a process with zenity - with ( + with ( # noqa: SIM117 Popen( [cmd, *opts], stdout=PIPE, stderr=STDOUT, ) as proc, - Popen( + ): + with Popen( [ f"{bin}", "--progress", @@ -46,16 +47,15 @@ def run_zenity(command: str, opts: list[str], msg: str) -> int: "--no-cancel", ], stdin=PIPE, - ) as zenity_proc, - ): - try: - proc.wait(timeout=300) - except TimeoutExpired: - zenity_proc.terminate() - log.warning("%s timed out after 5 min.", cmd) - raise TimeoutError - zenity_proc.stdin.close() - ret = zenity_proc.wait() + ) as zenity_proc: + try: + proc.wait(timeout=300) + except TimeoutExpired: + zenity_proc.terminate() + log.warning("%s timed out after 5 min.", cmd) + raise TimeoutError + zenity_proc.stdin.close() + ret = zenity_proc.wait() if ret: log.warning("zenity exited with the status code: %s", ret)