Skip to content

Commit 0f28dcc

Browse files
committed
feat(cli): add force option to stop command
- Introduced a `--force` flag to the `stop` command for immediate termination of the application. - If the flag is used, it forcibly kills the specified processes instead of sending a stop command.
1 parent 764a3f9 commit 0f28dcc

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/cli.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -213,6 +213,7 @@ def parse_arguments(self):
213213

214214
stop_parser = subparsers.add_parser("stop", help="Stop the application")
215215
stop_parser.add_argument("-s", "--silent", action="store_true", help="Silence print messages")
216+
stop_parser.add_argument("-f", "--force", action="store_true", help="Force stop the application")
216217

217218
reload_parser = subparsers.add_parser("reload", help="Reload the application")
218219
reload_parser.add_argument("-s", "--silent", action="store_true", help="Silence print messages")
@@ -263,7 +264,12 @@ def parse_arguments(self):
263264
sys.exit(0)
264265

265266
elif args.command == "stop":
266-
self.send_command_to_application("stop")
267+
if args.force:
268+
for proc in ["yasb.exe", "yasb_themes.exe"]:
269+
if is_process_running(proc):
270+
subprocess.run(["taskkill", "/f", "/im", proc], creationflags=subprocess.CREATE_NO_WINDOW)
271+
else:
272+
self.send_command_to_application("stop")
267273
sys.exit(0)
268274

269275
elif args.command == "reload":

0 commit comments

Comments
 (0)