mirror of
https://github.com/sunnypilot/sunnypilot.git
synced 2026-08-22 22:03:46 +08:00
Update process.py
This commit is contained in:
@@ -105,6 +105,12 @@ class ManagerProcess(ABC):
|
||||
|
||||
return ret
|
||||
|
||||
def reap(self) -> None:
|
||||
# a process that exited on its own is otherwise never restarted: start() early-returns while proc is
|
||||
# set, and only stop() clears it. modeld dying on a bad eGPU load left it dead for the whole drive.
|
||||
if self.proc is not None and self.proc.exitcode is not None:
|
||||
self.stop()
|
||||
|
||||
def signal(self, sig: int) -> None:
|
||||
if self.proc is None:
|
||||
return
|
||||
@@ -145,6 +151,7 @@ class NativeProcess(ManagerProcess):
|
||||
# In case we only tried a non blocking stop we need to stop it before restarting
|
||||
if self.shutting_down:
|
||||
self.stop()
|
||||
self.reap()
|
||||
|
||||
if self.proc is not None:
|
||||
return
|
||||
@@ -169,6 +176,7 @@ class PythonProcess(ManagerProcess):
|
||||
# In case we only tried a non blocking stop we need to stop it before restarting
|
||||
if self.shutting_down:
|
||||
self.stop()
|
||||
self.reap()
|
||||
|
||||
if self.proc is not None:
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user