mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-07-18 00:29:42 +03:00
fix(web): port check, process isolation, startup diagnostics
- web-publish: check port availability before starting, show which process holds it; run httpd -t on startup failure for diagnostics - All scripts: filter httpd processes by path (Resolve-Path match) to avoid killing or misidentifying a global Apache installation - web-info: warn about foreign httpd processes - web-stop: only stop our Apache instance Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -46,14 +46,25 @@ if (-not (Test-Path $httpdExe)) {
|
||||
exit 0
|
||||
}
|
||||
|
||||
# --- Check process ---
|
||||
$httpdProc = Get-Process httpd -ErrorAction SilentlyContinue
|
||||
if ($httpdProc) {
|
||||
$pids = ($httpdProc | ForEach-Object { $_.Id }) -join ", "
|
||||
# --- Check process (only our Apache) ---
|
||||
$httpdExeNorm = (Resolve-Path $httpdExe -ErrorAction SilentlyContinue).Path
|
||||
$ourProc = Get-Process httpd -ErrorAction SilentlyContinue | Where-Object {
|
||||
try { $_.Path -eq $httpdExeNorm } catch { $false }
|
||||
}
|
||||
$foreignProc = Get-Process httpd -ErrorAction SilentlyContinue | Where-Object {
|
||||
try { $_.Path -ne $httpdExeNorm } catch { $true }
|
||||
}
|
||||
if ($ourProc) {
|
||||
$pids = ($ourProc | ForEach-Object { $_.Id }) -join ", "
|
||||
Write-Host "Status: Запущен (PID: $pids)" -ForegroundColor Green
|
||||
} else {
|
||||
Write-Host "Status: Остановлен" -ForegroundColor Yellow
|
||||
}
|
||||
if ($foreignProc) {
|
||||
$fpid = ($foreignProc | Select-Object -First 1).Id
|
||||
$fpath = try { ($foreignProc | Select-Object -First 1).Path } catch { "?" }
|
||||
Write-Host "[WARN] Обнаружен сторонний Apache (PID: $fpid, $fpath)" -ForegroundColor Yellow
|
||||
}
|
||||
|
||||
Write-Host "Path: $ApachePath"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user