diff --git a/install.ps1 b/install.ps1 index 0645188..a9bab85 100644 --- a/install.ps1 +++ b/install.ps1 @@ -78,14 +78,18 @@ if (-not (Test-Path .git)) { $launcher = Join-Path $PSScriptRoot "Launch-Dashboard.bat" $desktop = [Environment]::GetFolderPath("Desktop") if ((Test-Path $launcher) -and (Test-Path $desktop)) { - $shortcutPath = Join-Path $desktop "Agentic OS Dashboard.lnk" - $shell = New-Object -ComObject WScript.Shell - $shortcut = $shell.CreateShortcut($shortcutPath) - $shortcut.TargetPath = $launcher - $shortcut.WorkingDirectory = $PSScriptRoot - $shortcut.Description = "Launch the Agentic OS dashboard" - $shortcut.Save() - Write-Host "Desktop shortcut created: $shortcutPath" + try { + $shortcutPath = Join-Path $desktop "Agentic OS Dashboard.lnk" + $shell = New-Object -ComObject WScript.Shell + $shortcut = $shell.CreateShortcut($shortcutPath) + $shortcut.TargetPath = $launcher + $shortcut.WorkingDirectory = $PSScriptRoot + $shortcut.Description = "Launch the Agentic OS dashboard" + $shortcut.Save() + Write-Host "Desktop shortcut created: $shortcutPath" + } catch { + Write-Warning "Could not create Desktop shortcut: $_" + } } Write-Host "" diff --git a/start.ps1 b/start.ps1 index a30da8b..a6da799 100644 --- a/start.ps1 +++ b/start.ps1 @@ -36,7 +36,7 @@ $pythonArgs = @($python.Args) & $pythonCommand @pythonArgs -m pip install -r requirements.txt --quiet -$configuredPort = & $pythonCommand @pythonArgs -c "import json; f=open('data/settings.json'); d=json.load(f); print(d.get('dashboard',{}).get('port',8080)); f.close()" 2>$null +$configuredPort = & $pythonCommand @pythonArgs -c "import json; f=open('data/settings.json'); d=json.load(f); print(int(d.get('dashboard',{}).get('port',8080))); f.close()" 2>$null if (-not $configuredPort) { $configuredPort = "8080" } $configuredPort = [int]$configuredPort diff --git a/start.sh b/start.sh index a143397..4dd584d 100755 --- a/start.sh +++ b/start.sh @@ -28,14 +28,21 @@ CONFIGURED_PORT=$($PYTHON -c "import json; f=open('data/settings.json'); d=json. # Find a free port starting at CONFIGURED_PORT (in case it's already taken by another app) PORT="$CONFIGURED_PORT" +FOUND=0 for _ in $(seq 1 20); do if ! (exec 3<>"/dev/tcp/127.0.0.1/${PORT}") 2>/dev/null; then + FOUND=1 break fi exec 3>&- 2>/dev/null || true PORT=$((PORT + 1)) done +if [ "$FOUND" -eq 0 ]; then + echo "ERROR: Could not find a free port after 20 attempts starting at ${CONFIGURED_PORT}." + exit 1 +fi + if [ "$PORT" != "$CONFIGURED_PORT" ]; then echo "WARNING: Port ${CONFIGURED_PORT} is already in use - using ${PORT} instead." fi