From 1e20334b3d3e2ef34d7351ace8295f89eebc6025 Mon Sep 17 00:00:00 2001 From: Marius Mutu Date: Thu, 6 Nov 2025 21:44:10 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20Git=20Pull=20&=20Restart=20-=20elimin?= =?UTF-8?q?=C4=83=20dubla=20confirmare?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- deployment/windows/scripts/menu.ps1 | 30 ++++++++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/deployment/windows/scripts/menu.ps1 b/deployment/windows/scripts/menu.ps1 index b0bbaf9..1ce3eba 100644 --- a/deployment/windows/scripts/menu.ps1 +++ b/deployment/windows/scripts/menu.ps1 @@ -295,11 +295,35 @@ function Invoke-GitPullRestart { Write-Host "[SUCCES] Proiect actualizat!" -ForegroundColor Green Write-Host "" - # Restart service if installed + # Restart service if installed (inline, fara script extern) $service = Get-Service -Name $ServiceName -ErrorAction SilentlyContinue if ($service) { - Write-Host "[INFO] Restart serviciu..." -ForegroundColor Cyan - & "$ScriptDir\restart_service.ps1" + Write-Host "[INFO] Oprire serviciu..." -ForegroundColor Cyan + 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 { Write-Host "[INFO] Serviciul nu este instalat, restart nu este necesar" -ForegroundColor Yellow }