Skip to content

Commit f17e303

Browse files
committed
fixes
1 parent 66f3c4a commit f17e303

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

bota/src/bota/vm.py

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -492,7 +492,20 @@ def get_filename_from_url(url):
492492
return os.path.basename(urlparse(url).path.rstrip("/"))
493493

494494
def kill_process(name):
495-
# Ask user for the name of process
495+
"""
496+
Terminates all processes matching the given name.
497+
498+
Args:
499+
name (str): The name of the process to terminate.
500+
501+
Behavior:
502+
- Iterates through all processes to find those matching the given name.
503+
- Extracts the process ID (PID) and sends a SIGKILL signal to terminate it.
504+
- If an error occurs during termination, it prints an error message.
505+
506+
Note:
507+
This function uses the `ps` command to find processes and may not work on non-Unix systems.
508+
"""
496509
import os, signal
497510
try:
498511
# iterating through each instance of the process
@@ -504,9 +517,8 @@ def kill_process(name):
504517

505518
# terminating process
506519
os.kill(int(pid), signal.SIGKILL)
507-
print("Killing",pid)
508-
except:
509-
print("Error Encountered while running script")
520+
except Exception as e:
521+
print(f"Error Encountered while killing {name}", e)
510522

511523
def install_desktop_app_in_vm(
512524
debian_installer_url,

0 commit comments

Comments
 (0)