mirror of
https://github.com/clearml/wexpect-venv
synced 2025-03-13 15:08:11 +00:00
[FIX] process termination: do not terminate a process, which has not been started.
This commit is contained in:
parent
80f63d47ef
commit
e62dfabc82
@ -292,6 +292,7 @@ class SpawnBase:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
logger.info('Deleting...')
|
logger.info('Deleting...')
|
||||||
|
if self.child_process is not None:
|
||||||
self.terminate()
|
self.terminate()
|
||||||
self.disconnect_from_child()
|
self.disconnect_from_child()
|
||||||
if self.safe_exit:
|
if self.safe_exit:
|
||||||
@ -425,6 +426,10 @@ class SpawnBase:
|
|||||||
def isalive(self, console=True):
|
def isalive(self, console=True):
|
||||||
"""True if the child is still alive, false otherwise"""
|
"""True if the child is still alive, false otherwise"""
|
||||||
|
|
||||||
|
if self.child_process is None:
|
||||||
|
# Child process has not been started... Not alive
|
||||||
|
return False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.exitstatus = self.child_process.wait(timeout=0)
|
self.exitstatus = self.child_process.wait(timeout=0)
|
||||||
except psutil.TimeoutExpired:
|
except psutil.TimeoutExpired:
|
||||||
|
@ -162,7 +162,7 @@ class ExceptionPexpect(Exception):
|
|||||||
def __filter_not_wexpect(self, trace_list_item):
|
def __filter_not_wexpect(self, trace_list_item):
|
||||||
"""This returns True if list item 0 the string 'wexpect.py' in it. """
|
"""This returns True if list item 0 the string 'wexpect.py' in it. """
|
||||||
|
|
||||||
if trace_list_item[0].find('wexpect.py') == -1:
|
if trace_list_item[0].find('spawn.py') == -1:
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
Loading…
Reference in New Issue
Block a user