mirror of
https://github.com/tcsenpai/UWINE.git
synced 2025-06-06 11:35:20 +00:00
ulwlg_run.py: Capture and return the exit code of the subprocess
* Return the exitcode of the subprocess from `main` in case the caller wants to do something this it. * Catch any exceptions during execution and return an error exitcode.
This commit is contained in:
parent
a7c38855bc
commit
709e0bd67a
11
ulwgl_run.py
11
ulwgl_run.py
@ -2,6 +2,7 @@
|
||||
|
||||
import os
|
||||
import argparse
|
||||
from traceback import print_exception
|
||||
from argparse import ArgumentParser, Namespace
|
||||
import sys
|
||||
from pathlib import Path
|
||||
@ -281,7 +282,7 @@ def build_command(
|
||||
return command
|
||||
|
||||
|
||||
def main() -> None: # noqa: D103
|
||||
def main() -> int: # noqa: D103
|
||||
env: Dict[str, str] = {
|
||||
"WINEPREFIX": "",
|
||||
"GAMEID": "",
|
||||
@ -327,8 +328,12 @@ def main() -> None: # noqa: D103
|
||||
os.environ[key] = val
|
||||
|
||||
build_command(env, command, opts)
|
||||
subprocess.run(command)
|
||||
return subprocess.run(command).returncode
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
try:
|
||||
sys.exit(main())
|
||||
except Exception as e: # noqa: BLE001
|
||||
print_exception(e)
|
||||
sys.exit(1)
|
||||
|
Loading…
x
Reference in New Issue
Block a user