28 lines
873 B
PowerShell
28 lines
873 B
PowerShell
param(
|
|
[int]$ApiPort = 8001,
|
|
[int]$WebPort = 5174,
|
|
[switch]$StopCloudflared
|
|
)
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
Get-CimInstance Win32_Process |
|
|
Where-Object { $_.CommandLine -like "*uvicorn app.main:app*--port $ApiPort*" } |
|
|
ForEach-Object { Stop-Process -Id $_.ProcessId -Force }
|
|
|
|
Get-CimInstance Win32_Process |
|
|
Where-Object {
|
|
$_.Name -eq "node.exe" -and
|
|
$_.CommandLine -and
|
|
$_.CommandLine -like "*vite*preview*" -and
|
|
$_.CommandLine -like "*$WebPort*"
|
|
} |
|
|
ForEach-Object { Stop-Process -Id $_.ProcessId -Force }
|
|
|
|
if ($StopCloudflared) {
|
|
Get-CimInstance Win32_Process |
|
|
Where-Object { $_.Name -eq "cloudflared.exe" -and $_.CommandLine -like "*vignette-config.yml*" } |
|
|
ForEach-Object { Stop-Process -Id $_.ProcessId -Force }
|
|
}
|
|
|
|
Write-Host "Stopped public API processes on port $ApiPort and public web preview on port $WebPort"
|