@@ -102,6 +102,8 @@ class Kill(Main):
102102 ids : list [str ] = arg ("ID" , "run ids" , nargs = "+" )
103103 dry_run : bool = flag ("dry-run" , "dry run (don't actually kill)" , default = False )
104104 remove : bool = flag ("remove" , "remove entry after killing" , default = False )
105+ group : bool = flag ("group" , "kill process group" , default = False )
106+ signal : str = flag ("signal" , "send signal" , default = None )
105107
106108 def init_argparse (self , argp : ArgumentParser ) -> None :
107109 argp .description = "Kill the process of a run id"
@@ -111,6 +113,7 @@ def start(self) -> None:
111113 _errdef = ["❌" , "Error" ]
112114 _noproc = ["👻" , "No process" ]
113115 _killed = ["💀" , "Killed" ]
116+ signal = int (self .signal ) if self .signal else None
114117 sp = Manager ()
115118 if self .ids :
116119 for x in sp .find_names (self .ids , ambiguous , no_record ):
@@ -119,7 +122,7 @@ def start(self) -> None:
119122 s = _killed
120123 else :
121124 if check_pid (x ["pid" ]):
122- if kill_pid (x ["pid" ], process_group = True ):
125+ if kill_pid (x ["pid" ], process_group = self . group ):
123126 s = _killed
124127 else :
125128 s = _noproc
0 commit comments