MCPcopy Create free account
hub / github.com/JamesDevaSingh/Controller-for-disabled / kill_process

Function kill_process

button_screen.py:36–59  ·  view source on GitHub ↗
(process_key)

Source from the content-addressed store, hash-verified

34
35# Function to kill a running process
36def kill_process(process_key):
37 process = running_processes.get(process_key)
38 if process and process.poll() is None: # Check if process exists and is still running
39 try:
40 # Try to terminate gracefully first
41 process.terminate()
42
43 # Wait a bit for process to terminate
44 try:
45 process.wait(timeout=3)
46 except subprocess.TimeoutExpired:
47 # If still running, force kill
48 process.kill()
49
50 running_processes[process_key] = None
51 update_status(f"{process_key.replace('_', ' ').title()} stopped")
52 return True
53 except Exception as e:
54 messagebox.showerror("Error", f"Failed to stop {process_key}: {e}")
55 return False
56 else:
57 messagebox.showinfo("Info", f"No running {process_key.replace('_', ' ').title()} process found")
58 running_processes[process_key] = None
59 return False
60
61# Function to show the gesture submenu
62def show_gesture_submenu():

Callers 1

Calls 1

update_statusFunction · 0.85

Tested by

no test coverage detected