Solver: Fix for windows version.

This commit is contained in:
Pierre-Antoine Rouby committed 2023-06-26 15:37:45 +02:00
1 parent 8e76778ce3
commit 4715b7e470
2 files changed
+34 -11

No files matched your search

+19 -9
View File
@@ -2,7 +2,12 @@
import os
from signal import SIGTERM, SIGSTOP, SIGCONT
try:
from signal import SIGTERM, SIGSTOP, SIGCONT
_signal = True
except:
_signal = False
from enum import Enum
from Model.Except import NotImplementedMethodeError
@@ -206,21 +211,26 @@ class AbstractSolver(object):
if process is not None:
self._process = process
if self._status == STATUS.PAUSED:
os.kill(self._process.pid(), SIGCONT)
self._status = STATUS.RUNNING
if _signal:
if self._status == STATUS.PAUSED:
os.kill(self._process.pid(), SIGCONT)
self._status = STATUS.RUNNING
else:
self.run_solver()
else:
self.run_solver()
return True
def pause(self):
if self._process is None:
return False
if _signal:
if self._process is None:
return False
os.kill(self._process.pid(), SIGSTOP)
self._status = STATUS.PAUSED
return True
os.kill(self._process.pid(), SIGSTOP)
self._status = STATUS.PAUSED
return True
return False
def stop(self):
if self._process is None: