From 848580f3ee98e8410b89dd5f48f3debfddbfaf2e Mon Sep 17 00:00:00 2001 From: tian <11429339@qq.com> Date: Wed, 22 Jul 2026 09:29:36 +0800 Subject: [PATCH] fix: mock alarm and minio use cmd window to avoid silent exit --- scripts/dev-env.ps1 | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/scripts/dev-env.ps1 b/scripts/dev-env.ps1 index 9c285ad..5285c27 100644 --- a/scripts/dev-env.ps1 +++ b/scripts/dev-env.ps1 @@ -119,12 +119,10 @@ function Invoke-Start { # 3. Mock alarm server (if uv available) Write-Banner "3/4 Mock Alarm Server" if (Get-Command uv -ErrorAction SilentlyContinue) { - $alarmProc = Start-Process -FilePath "uv" ` - -ArgumentList "run", "--with", "flask", $mockAlarm ` - -WorkingDirectory (Join-Path $edgeDir "scripts") ` - -WindowStyle Minimized ` - -PassThru - Write-Host " [START] mock_alarm_server (PID=$($alarmProc.Id))" -ForegroundColor Green + $alarmBat = Join-Path $edgeDir "scripts\mock-alarm.bat" + "@echo off`r`ncd /d `"$(Join-Path $edgeDir 'scripts')`"`r`nuv run --with flask mock_alarm_server.py" | Out-File -FilePath $alarmBat -Encoding ASCII + Start-Process "cmd" -ArgumentList "/k", $alarmBat + Write-Host " [START] mock_alarm_server (端口 8080)" -ForegroundColor Green } else { Write-Host " [SKIP] uv 未安装" -ForegroundColor Yellow } @@ -152,7 +150,9 @@ function Invoke-Start { Write-Banner "MinIO (object storage)" if (Test-Path $minio) { if (-not (Test-Path $minioData)) { New-Item -ItemType Directory -Path $minioData -Force | Out-Null } - Start-Detached "minio" $minio @("server", $minioData, "--address", ":9000", "--console-address", ":9001") + $minioBat = Join-Path $env:TEMP "safesight-minio.bat" + "@echo off`r`n`"$minio`" server `"$minioData`" --address :9000 --console-address :9001" | Out-File -FilePath $minioBat -Encoding ASCII + Start-Process "cmd" -ArgumentList "/k", $minioBat Write-Host " Console: http://localhost:9001 (admin/password)" -ForegroundColor White }