Files
lesson-highlights/temp/kill_python.ps1
T

13 lines
379 B
PowerShell

# Kill all python processes related to our CLI
Get-Process python -ErrorAction SilentlyContinue | Stop-Process -Force
Start-Sleep 3
# Verify killed
$remaining = Get-Process python -ErrorAction SilentlyContinue
if ($remaining) {
Write-Host "Still running:"
$remaining | ForEach-Object { Write-Host " PID:" $_.Id }
} else {
Write-Host "All python processes killed"
}