Kill Docker Desktop processes on Windows. Returns: True if processes were killed successfully, False otherwise
()
| 161 | |
| 162 | |
| 163 | def _kill_docker_desktop_windows() -> bool: |
| 164 | """Kill Docker Desktop processes on Windows. |
| 165 | |
| 166 | Returns: |
| 167 | True if processes were killed successfully, False otherwise |
| 168 | """ |
| 169 | try: |
| 170 | # Kill Docker Desktop processes |
| 171 | subprocess.run( |
| 172 | ["taskkill", "/F", "/IM", "Docker Desktop.exe"], |
| 173 | capture_output=True, |
| 174 | timeout=10, |
| 175 | ) |
| 176 | |
| 177 | # Also kill the com.docker.backend process |
| 178 | subprocess.run( |
| 179 | ["taskkill", "/F", "/IM", "com.docker.backend.exe"], |
| 180 | capture_output=True, |
| 181 | timeout=10, |
| 182 | ) |
| 183 | |
| 184 | # Give processes time to terminate |
| 185 | time.sleep(3) |
| 186 | return True |
| 187 | |
| 188 | except KeyboardInterrupt as ki: |
| 189 | handle_keyboard_interrupt(ki) |
| 190 | raise |
| 191 | except Exception: |
| 192 | return False |
| 193 | |
| 194 | |
| 195 | def _restart_docker_desktop_windows() -> tuple[bool, str]: |
no test coverage detected