Skip to content

Commit

Permalink
wait for the process to be terminated (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
DomAmato committed Mar 24, 2020
1 parent fe39438 commit 6cae05b
Showing 3 changed files with 10 additions and 3 deletions.
5 changes: 4 additions & 1 deletion Hologram/Network/Modem/ModemMode/PPP.py
Original file line number Diff line number Diff line change
@@ -78,7 +78,10 @@ def __shut_down_existing_ppp_session(self):
for pid in pid_list:
self.logger.info('Killing pid %s that currently have an active PPP session',
pid)
psutil.Process(pid).terminate()
process = psutil.Process(pid)
process.terminate()
# Wait at least 10 seconds for the process to terminate
process.wait(10)

def __check_for_existing_ppp_sessions(self):

4 changes: 3 additions & 1 deletion scripts/hologram_modem.py
Original file line number Diff line number Diff line change
@@ -73,7 +73,9 @@ def run_modem_disconnect(args):
if 'pppd' in pinfo['name']:
print('Found existing PPP session on pid: %s' % pinfo['pid'])
print('Killing pid %s now' % pinfo['pid'])
psutil.Process(pinfo['pid']).terminate()
process = psutil.Process(pinfo['pid'])
process.terminate()
process.wait()

def run_modem_signal(args):
cloud = CustomCloud(None, network='cellular')
4 changes: 3 additions & 1 deletion scripts/hologram_network.py
Original file line number Diff line number Diff line change
@@ -40,7 +40,9 @@ def run_network_disconnect(args):
if 'pppd' in pinfo['name']:
print('Found existing PPP session on pid: %s' % pinfo['pid'])
print('Killing pid %s now' % pinfo['pid'])
psutil.Process(pinfo['pid']).terminate()
process = psutil.Process(pinfo['pid'])
process.terminate()
process.wait()

_run_handlers = {
'network_connect': run_network_connect,

0 comments on commit 6cae05b

Please sign in to comment.