fix: auto-start local adb daemon and optimize path discovery across Linux, macOS and Windows
This commit is contained in:
1 parent
8b3cfe9bb3
commit
41b1b94706
7 files changed
+114
No files matched your search
@@ -34,7 +34,9 @@ function Update-EnvironmentPath {
|
||||
$standardDirs = @(
|
||||
"$env:LOCALAPPDATA\Microsoft\WinGet\Links",
|
||||
"$env:LOCALAPPDATA\Android\Sdk\platform-tools",
|
||||
"$env:LOCALAPPDATA\Android\android-sdk\platform-tools",
|
||||
"$env:ProgramFiles\Android\platform-tools",
|
||||
"${env:ProgramFiles(x86)}\Android\android-sdk\platform-tools",
|
||||
"$env:ProgramFiles\nodejs",
|
||||
"${env:ProgramFiles(x86)}\nodejs",
|
||||
"$env:APPDATA\npm",
|
||||
@@ -42,16 +44,34 @@ function Update-EnvironmentPath {
|
||||
"$env:LOCALAPPDATA\Programs\node",
|
||||
"$env:USERPROFILE\.local\share\platform-tools",
|
||||
"$env:USERPROFILE\.local\share\node",
|
||||
"$env:LOCALAPPDATA\nvm",
|
||||
"$env:ProgramData\nvm",
|
||||
"C:\ProgramData\chocolatey\bin",
|
||||
"$env:USERPROFILE\scoop\shims",
|
||||
"$env:USERPROFILE\.local\bin",
|
||||
"$env:USERPROFILE\.cargo\bin"
|
||||
)
|
||||
if ($env:ANDROID_HOME) { $standardDirs += "$env:ANDROID_HOME\platform-tools" }
|
||||
if ($env:ANDROID_SDK_ROOT) { $standardDirs += "$env:ANDROID_SDK_ROOT\platform-tools" }
|
||||
if ($env:NVM_HOME) { $standardDirs += $env:NVM_HOME }
|
||||
if ($env:NVM_SYMLINK) { $standardDirs += $env:NVM_SYMLINK }
|
||||
|
||||
$regPath = [Environment]::GetEnvironmentVariable("Path", "User") + ";" + [Environment]::GetEnvironmentVariable("Path", "Machine")
|
||||
$currentPaths = ($env:PATH -split ";") + ($regPath -split ";") + $standardDirs | Where-Object { [string]::IsNullOrWhiteSpace($_) -eq $false -and (Test-Path $_) } | Select-Object -Unique
|
||||
$env:PATH = $currentPaths -join ";"
|
||||
}
|
||||
|
||||
function Start-LocalAdbServer {
|
||||
if (Test-CommandExists "adb") {
|
||||
try {
|
||||
$origSocket = $env:ADB_SERVER_SOCKET
|
||||
Remove-Item Env:\ADB_SERVER_SOCKET -ErrorAction SilentlyContinue
|
||||
& adb start-server 2>$null | Out-Null
|
||||
if ($origSocket) { $env:ADB_SERVER_SOCKET = $origSocket }
|
||||
} catch {}
|
||||
}
|
||||
}
|
||||
|
||||
function Test-CommandExists {
|
||||
param([string]$Command)
|
||||
$res = Get-Command $Command -ErrorAction SilentlyContinue
|
||||
@@ -164,6 +184,9 @@ if ($missingCore.Count -gt 0) {
|
||||
}
|
||||
}
|
||||
|
||||
# Ensure local ADB daemon is warm & listening so probes do not hit 'Connection refused'
|
||||
Start-LocalAdbServer
|
||||
|
||||
# 4. Check or initialize .env
|
||||
if (-not (Test-Path ".env")) {
|
||||
if (Test-Path ".env.example") {
|
||||
@@ -259,6 +282,9 @@ if ($installMcp -match "^[Yy]") {
|
||||
Write-Host ""
|
||||
|
||||
# 8. Launch unified Showcase UI & open browser
|
||||
# Ensure local ADB daemon is warm & listening
|
||||
Start-LocalAdbServer
|
||||
|
||||
# Launch via `python -m artemis` (not the `artemis.exe` console-script shim) so the
|
||||
# long-running server never locks .venv\Scripts\artemis.exe against `uv sync` reinstalls.
|
||||
Write-Host " [INFO] Launching Artemis Showcase UI & Admin Console..." -ForegroundColor Green
|
||||
|
||||
Reference in new issue
Block a user