Skip to content

Commit

Permalink
Option for partial match on kill
Browse files Browse the repository at this point in the history
  • Loading branch information
JaimeCernuda committed Nov 5, 2023
1 parent b57cc56 commit 59721eb
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions jarvis_util/shell/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,12 @@ class Kill(Exec):
Kill all processes which match the name regex.
"""

def __init__(self, cmd, exec_info):
def __init__(self, cmd, exec_info, partial=False):
"""
Kill all processes which match the name regex.
:param cmd: A regex for the command to kill
:param exec_info: Info needed to execute the command
"""
super().__init__(f"pkill {cmd}", exec_info)
partial_cmd = "-f" if partial else ""
super().__init__(f"pkill {partial_cmd} {cmd}", exec_info)

0 comments on commit 59721eb

Please sign in to comment.