Skip to content

Commit 4bacc26

Browse files
committed
umu_util: do not use single with block
- Related to lutris/lutris#5434
1 parent 1ff9b1b commit 4bacc26

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

umu/umu_util.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,14 @@ def run_zenity(command: str, opts: list[str], msg: str) -> int:
2929
return -1
3030

3131
# Communicate a process with zenity
32-
with (
32+
with ( # noqa: SIM117
3333
Popen(
3434
[cmd, *opts],
3535
stdout=PIPE,
3636
stderr=STDOUT,
3737
) as proc,
38-
Popen(
38+
):
39+
with Popen(
3940
[
4041
f"{bin}",
4142
"--progress",
@@ -46,16 +47,15 @@ def run_zenity(command: str, opts: list[str], msg: str) -> int:
4647
"--no-cancel",
4748
],
4849
stdin=PIPE,
49-
) as zenity_proc,
50-
):
51-
try:
52-
proc.wait(timeout=300)
53-
except TimeoutExpired:
54-
zenity_proc.terminate()
55-
log.warning("%s timed out after 5 min.", cmd)
56-
raise TimeoutError
57-
zenity_proc.stdin.close()
58-
ret = zenity_proc.wait()
50+
) as zenity_proc:
51+
try:
52+
proc.wait(timeout=300)
53+
except TimeoutExpired:
54+
zenity_proc.terminate()
55+
log.warning("%s timed out after 5 min.", cmd)
56+
raise TimeoutError
57+
zenity_proc.stdin.close()
58+
ret = zenity_proc.wait()
5959

6060
if ret:
6161
log.warning("zenity exited with the status code: %s", ret)

0 commit comments

Comments
 (0)