Skip to content

Commit

Permalink
Added method to check if the node's pid is still active. GH EOSIO#4812
Browse files Browse the repository at this point in the history
  • Loading branch information
brianjohnson5972 committed Jul 23, 2018
1 parent b472d55 commit 4053309
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions tests/Node.py
Original file line number Diff line number Diff line change
Expand Up @@ -991,6 +991,23 @@ def myFunc():
self.killed=True
return True

def verifyAlive(self):
if Utils.Debug: Utils.Print("Checking if node(pid=%s) is alive(killed=%s): %s" % (self.pid, self.killed, self.cmd))
if self.killed or self.pid is None:
return False

try:
os.kill(self.pid, 0)
except ProcessLookupError as ex:
# mark node as killed
self.pid=None
self.killed=True
return False
except PermissionError as ex:
return True
else:
return True

# TBD: make nodeId an internal property
# pylint: disable=too-many-locals
def relaunch(self, nodeId, chainArg, newChain=False, timeout=Utils.systemWaitTimeout, addOrSwapFlags=None):
Expand Down

0 comments on commit 4053309

Please sign in to comment.