Fix Git Pull & Restart - elimină dubla confirmare

Implementează logica de restart inline în loc să apeleze restart_service.ps1
pentru a evita 2 confirmări consecutive (Read-Host).

Îmbunătățiri:
- Restart serviciu inline (stop + start direct în funcție)
- Un singur prompt la final pentru revenire în meniu
- Mesaje de status detaliate pentru fiecare pas
- Gestionare erori pentru stop și start serviciu

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-11-06 21:44:10 +02:00
parent 4e58e663e9
commit 1e20334b3d

View File

@@ -295,11 +295,35 @@ function Invoke-GitPullRestart {
Write-Host "[SUCCES] Proiect actualizat!" -ForegroundColor Green Write-Host "[SUCCES] Proiect actualizat!" -ForegroundColor Green
Write-Host "" Write-Host ""
# Restart service if installed # Restart service if installed (inline, fara script extern)
$service = Get-Service -Name $ServiceName -ErrorAction SilentlyContinue $service = Get-Service -Name $ServiceName -ErrorAction SilentlyContinue
if ($service) { if ($service) {
Write-Host "[INFO] Restart serviciu..." -ForegroundColor Cyan Write-Host "[INFO] Oprire serviciu..." -ForegroundColor Cyan
& "$ScriptDir\restart_service.ps1" try {
Stop-Service -Name $ServiceName -Force
Write-Host "[OK] Serviciu oprit" -ForegroundColor Green
Start-Sleep -Seconds 2
} catch {
Write-Host "[AVERTIZARE] Oprirea a esuat, incercam oprire fortata..." -ForegroundColor Yellow
sc.exe stop $ServiceName | Out-Null
Start-Sleep -Seconds 2
}
Write-Host "[INFO] Pornire serviciu..." -ForegroundColor Cyan
try {
Start-Service -Name $ServiceName
Start-Sleep -Seconds 2
$service = Get-Service -Name $ServiceName
if ($service.Status -eq "Running") {
Write-Host "[SUCCES] Serviciu restartat cu succes!" -ForegroundColor Green
} else {
Write-Host "[EROARE] Serviciul nu ruleaza dupa restart!" -ForegroundColor Red
}
} catch {
Write-Host "[EROARE] Pornirea serviciului a esuat!" -ForegroundColor Red
Write-Host "Verificati logurile pentru detalii" -ForegroundColor Yellow
}
} else { } else {
Write-Host "[INFO] Serviciul nu este instalat, restart nu este necesar" -ForegroundColor Yellow Write-Host "[INFO] Serviciul nu este instalat, restart nu este necesar" -ForegroundColor Yellow
} }