Skip to content

Commit

Permalink
app: attempt SIGTERM for stop
Browse files Browse the repository at this point in the history
Change-Id: I04778488eb2c58ef560a4243ac91bbf5022cf530
  • Loading branch information
pulsejet committed Feb 5, 2025
1 parent b95d194 commit 739fc73
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion minindn/apps/application.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@
# along with Mini-NDN, e.g., in COPYING.md file.
# If not, see <http://www.gnu.org/licenses/>.

import subprocess
from minindn.util import getPopen
from typing import Union, Optional

class Application(object):
process: subprocess.Popen

def __init__(self, node):
self.node = node
self.process = None
Expand All @@ -48,7 +51,11 @@ def start(self, command: Union[str, list], logfile: Optional[str]=None, envDict:

def stop(self):
if self.process is not None:
self.process.kill()
try:
self.process.terminate()
self.process.wait(timeout=5)
except subprocess.TimeoutExpired:
self.process.kill()
self.process = None
if self.logfile is not None:
self.logfile.close()

0 comments on commit 739fc73

Please sign in to comment.