Kill IDE processes.
(ide, force)
| 240 | @click.option('--ide', required=True, help='IDE type (vscode, cursor, windsurf, jetbrains)') |
| 241 | @click.option('--force', is_flag=True, help='Force kill processes') |
| 242 | def kill_processes_command(ide, force): |
| 243 | """Kill IDE processes.""" |
| 244 | import asyncio |
| 245 | from .process_manager import ProcessManager |
| 246 | |
| 247 | try: |
| 248 | ide_type = parse_ide_type(ide) |
| 249 | ide_name = get_ide_display_name(ide_type) |
| 250 | |
| 251 | pm = ProcessManager() |
| 252 | |
| 253 | # 检查进程 |
| 254 | processes = pm.get_ide_processes(ide_type) |
| 255 | if not processes: |
| 256 | print_info(f"未找到 {ide_name} 进程") |
| 257 | return |
| 258 | |
| 259 | print_warning(f"即将终止 {len(processes)} 个 {ide_name} 进程") |
| 260 | for proc in processes: |
| 261 | print_warning(f" {proc}") |
| 262 | |
| 263 | if not force: |
| 264 | if not click.confirm("确定要终止这些进程吗?"): |
| 265 | print_info("操作已取消") |
| 266 | return |
| 267 | |
| 268 | # 终止进程 |
| 269 | async def kill_processes(): |
| 270 | return await pm.kill_ide_processes(ide_type, force=True) |
| 271 | |
| 272 | success = asyncio.run(kill_processes()) |
| 273 | |
| 274 | if success: |
| 275 | print_success("所有进程已成功终止") |
| 276 | else: |
| 277 | print_warning("部分进程可能无法终止") |
| 278 | |
| 279 | except Exception as e: |
| 280 | print_error(f"终止进程失败: {e}") |
| 281 | |
| 282 | @main_cli.command("file-cleanup") |
| 283 | @click.option('--ide', required=True, help='IDE type (vscode, cursor, windsurf, jetbrains)') |
nothing calls this directly
no test coverage detected