mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-02-06 23:59:18 +08:00
improved server subprocess launch failure error handling
This commit is contained in:
parent
d251aee045
commit
a09232daa1
@ -583,17 +583,24 @@ class ServerManagerApp:
|
|||||||
binary_name = ('ballisticacore_headless.exe'
|
binary_name = ('ballisticacore_headless.exe'
|
||||||
if os.name == 'nt' else './ballisticacore_headless')
|
if os.name == 'nt' else './ballisticacore_headless')
|
||||||
assert self._ba_root_path is not None
|
assert self._ba_root_path is not None
|
||||||
self._subprocess = subprocess.Popen(
|
self._subprocess = None
|
||||||
[binary_name, '-cfgdir', self._ba_root_path],
|
try:
|
||||||
stdin=subprocess.PIPE,
|
self._subprocess = subprocess.Popen(
|
||||||
cwd='dist')
|
[binary_name, '-cfgdir', self._ba_root_path],
|
||||||
|
stdin=subprocess.PIPE,
|
||||||
|
cwd='dist')
|
||||||
|
except Exception as exc:
|
||||||
|
print(f'Error launching server subprocess: {exc}',
|
||||||
|
file=sys.stderr,
|
||||||
|
flush=True)
|
||||||
|
|
||||||
# Do the thing.
|
# Do the thing.
|
||||||
# No matter how this ends up, make sure the process is dead after.
|
# No matter how this ends up, make sure the process is dead after.
|
||||||
try:
|
if self._subprocess is not None:
|
||||||
self._run_subprocess_until_exit()
|
try:
|
||||||
finally:
|
self._run_subprocess_until_exit()
|
||||||
self._kill_subprocess()
|
finally:
|
||||||
|
self._kill_subprocess()
|
||||||
|
|
||||||
# If we want to die completely after this subprocess has ended,
|
# If we want to die completely after this subprocess has ended,
|
||||||
# tell the main thread to die.
|
# tell the main thread to die.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user