Skip to content

Commit e0fd609

Browse files
committed
umu_run: fix subreaping when command errors
- Fixes a bug where descendent processes would fail to be reaped in the case the user forcefully terminates the launcher (e.g., control+c). In the event that subprocess.run raises an error due to any failure in the command execution, it would kill Reaper. Therefore, subprocess.run should always silently fail in this case for reaping to occur and the launcher handle non-zero statuses
1 parent 11ca492 commit e0fd609

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

umu/umu_run.py

+7-6
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
from typing import Dict, Any, List, Set, Union, Tuple
88
from umu_plugins import enable_steam_game_drive, set_env_toml, enable_reaper
99
from re import match
10-
from subprocess import run, CalledProcessError
10+
from subprocess import run
1111
from umu_dl_util import get_umu_proton
1212
from umu_consts import PROTON_VERBS, DEBUG_FORMAT, STEAM_COMPAT, UMU_LOCAL
1313
from umu_util import setup_umu
@@ -255,7 +255,7 @@ def build_command(
255255
return command
256256

257257

258-
def main() -> None: # noqa: D103
258+
def main() -> int: # noqa: D103
259259
env: Dict[str, str] = {
260260
"WINEPREFIX": "",
261261
"GAMEID": "",
@@ -350,17 +350,18 @@ def main() -> None: # noqa: D103
350350
build_command(env, UMU_LOCAL, command, opts)
351351
log.debug("%s", command)
352352

353-
return run(command, check=True)
353+
return run(command, check=False).returncode
354354

355355

356356
if __name__ == "__main__":
357357
try:
358-
main()
358+
sys.exit(main())
359359
except KeyboardInterrupt:
360360
log.warning("Keyboard Interrupt")
361361
sys.exit(1)
362-
except CalledProcessError:
363-
log.exception("CalledProcessError")
362+
except SystemExit as e:
363+
if e.code != 0:
364+
raise Exception(e)
364365
except Exception:
365366
log.exception("Exception")
366367
sys.exit(1)

0 commit comments

Comments
 (0)