|
|
@@ -24,12 +24,19 @@ $VenvPython = Join-Path $GuiDir ".venv\Scripts\python.exe"
|
|
|
$AppScript = Join-Path $Root "apps\gui\app.py"
|
|
|
$EnvFile = Join-Path $Root ".env"
|
|
|
$EnvExample = Join-Path $Root ".env.example"
|
|
|
+$LogFile = Join-Path $Root "start_log.txt"
|
|
|
+
|
|
|
+# Write all output to log file so errors are readable even if window closes
|
|
|
+Start-Transcript -Path $LogFile -Append | Out-Null
|
|
|
+Write-Host "=== start.ps1 $(Get-Date -Format 'yyyy-MM-dd HH:mm:ss') Mode=$Mode ==="
|
|
|
|
|
|
function Write-Step($msg) { Write-Host "`n==> $msg" -ForegroundColor Cyan }
|
|
|
function Write-OK($msg) { Write-Host " [OK] $msg" -ForegroundColor Green }
|
|
|
function Write-Warn($msg) { Write-Host " [!!] $msg" -ForegroundColor Yellow }
|
|
|
function Write-Fail($msg) {
|
|
|
Write-Host "`n[FAIL] $msg" -ForegroundColor Red
|
|
|
+ Write-Host " Log: $LogFile" -ForegroundColor DarkGray
|
|
|
+ try { Stop-Transcript | Out-Null } catch {}
|
|
|
Write-Host "`n Press Enter to close..." -ForegroundColor DarkGray
|
|
|
$null = Read-Host
|
|
|
exit 1
|
|
|
@@ -38,6 +45,8 @@ function Write-Fail($msg) {
|
|
|
# Keep window open on any unhandled error
|
|
|
trap {
|
|
|
Write-Host "`n[ERROR] $_" -ForegroundColor Red
|
|
|
+ Write-Host " Log: $LogFile" -ForegroundColor DarkGray
|
|
|
+ try { Stop-Transcript | Out-Null } catch {}
|
|
|
Write-Host "`n Press Enter to close..." -ForegroundColor DarkGray
|
|
|
$null = Read-Host
|
|
|
exit 1
|
|
|
@@ -266,5 +275,7 @@ if (-not $SkipSpectrometer) {
|
|
|
Write-Host " Stop all: .\stop.ps1"
|
|
|
Write-Host " Update code: .\update.bat"
|
|
|
Write-Host ""
|
|
|
+Write-Host " Log saved to: $LogFile" -ForegroundColor DarkGray
|
|
|
+try { Stop-Transcript | Out-Null } catch {}
|
|
|
Write-Host " Press Enter to close this window..." -ForegroundColor DarkGray
|
|
|
$null = Read-Host
|