Skip to content

Commit

Permalink
umu_util: do not use single with block
Browse files Browse the repository at this point in the history
- Related to lutris/lutris#5434
  • Loading branch information
R1kaB3rN committed Jun 2, 2024
1 parent 1ff9b1b commit 4bacc26
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions umu/umu_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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)
Expand Down

0 comments on commit 4bacc26

Please sign in to comment.