-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcleanup_browsers.vsh
More file actions
28 lines (23 loc) · 1.37 KB
/
Copy pathcleanup_browsers.vsh
File metadata and controls
28 lines (23 loc) · 1.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env -S v run
import os
fn main() {
println('\033[33mStopping orphaned Edge browser instances...\033[0m')
// Find and kill headless/remote-debugging Edge processes
result :=
os.execute('powershell -NoProfile -Command "Get-Process msedge -ErrorAction SilentlyContinue | Where-Object { \$_.CommandLine -like \'*--headless*\' -or \$_.CommandLine -like \'*--remote-debugging-port*\' } | Measure-Object | Select-Object -ExpandProperty Count"')
count := result.output.trim_space().int()
if count > 0 {
println('\033[33mFound ${count} orphaned Edge processes\033[0m')
os.system('powershell -NoProfile -Command "Get-Process msedge -ErrorAction SilentlyContinue | Where-Object { \$_.CommandLine -like \'*--headless*\' -or \$_.CommandLine -like \'*--remote-debugging-port*\' } | Stop-Process -Force -ErrorAction SilentlyContinue"')
println('\033[32m✓ Cleaned up Edge processes\033[0m')
} else {
println('\033[32mNo orphaned Edge processes found\033[0m')
}
// Warn if multiple EdgeDriver instances are running
driver_result :=
os.execute('powershell -NoProfile -Command "Get-Process msedgedriver -ErrorAction SilentlyContinue | Measure-Object | Select-Object -ExpandProperty Count"')
driver_count := driver_result.output.trim_space().int()
if driver_count > 1 {
println('\033[33mWarning: Multiple EdgeDriver instances found. You may want to restart EdgeDriver.\033[0m')
}
}