Skip to content

Commit

Permalink
use sigkill instead of sigterm
Browse files Browse the repository at this point in the history
  • Loading branch information
wh1te909 committed May 22, 2024
1 parent 4e00fb1 commit 3f9aab3
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions api/tacticalrmm/core/consumers.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import os
import pty
import select
import signal
import struct
import subprocess
import termios
import threading
import signal
import uuid
from contextlib import suppress

Expand All @@ -20,6 +20,7 @@
from agents.models import Agent
from tacticalrmm.constants import AgentMonType
from tacticalrmm.helpers import days_until_cert_expires
from tacticalrmm.logger import logger


def _has_perm(user, perm: str) -> bool:
Expand Down Expand Up @@ -199,9 +200,13 @@ def write_to_pty(self, message):

def kill_pty(self):
if self.subprocess is not None:
os.killpg(os.getpgid(self.child_pid), signal.SIGTERM)
self.subprocess = None
self.child_pid = None
try:
os.killpg(os.getpgid(self.child_pid), signal.SIGKILL)
except Exception as e:
logger.error(f"Failed to kill process group: {str(e)}")
finally:
self.subprocess = None
self.child_pid = None

def disconnect(self, code):
self.connected = False
Expand Down

0 comments on commit 3f9aab3

Please sign in to comment.