wip: spinner por-fila en Investigate + spawn directo de python en launcher (incluye trabajo acumulado del arbol)
This commit is contained in:
@@ -132,10 +132,18 @@ $proc = $null
|
||||
|
||||
foreach ($candidate in $candidates) {
|
||||
Remove-Item '.run\server.log' -Force -ErrorAction SilentlyContinue
|
||||
Remove-Item '.run\server.err.log' -Force -ErrorAction SilentlyContinue
|
||||
Out-Line " [...] Encendiendo el servidor (intento $candidate)..." Gray
|
||||
$cmdLine = '/c "' + $PythonExe + '" -m uvicorn yt_scraper.webapp.app:app --host 127.0.0.1 --port ' + $candidate + ' --log-level info > ".run\server.log" 2>&1'
|
||||
# Spawn directo de python: un wrapper cmd /c con la ruta entre comillas
|
||||
# dispara el quote-stripping de cmd cuando la ruta tiene espacios y el
|
||||
# comando muere en silencio. Start-Process con array de args no sufre eso,
|
||||
# y ademas server.info registra el PID real de python (no el del wrapper).
|
||||
try {
|
||||
$proc = Start-Process -FilePath 'cmd.exe' -ArgumentList $cmdLine -WorkingDirectory $root -WindowStyle Minimized -PassThru
|
||||
$proc = Start-Process -FilePath $PythonExe `
|
||||
-ArgumentList @('-m','uvicorn','yt_scraper.webapp.app:app','--host','127.0.0.1','--port',"$candidate",'--log-level','info') `
|
||||
-WorkingDirectory $root -WindowStyle Minimized -PassThru `
|
||||
-RedirectStandardOutput "$root\.run\server.log" `
|
||||
-RedirectStandardError "$root\.run\server.err.log"
|
||||
} catch {
|
||||
Out-Line " [warn] Start-Process fallo en $candidate : $($_.Exception.Message)" Yellow
|
||||
continue
|
||||
@@ -158,12 +166,14 @@ foreach ($candidate in $candidates) {
|
||||
|
||||
if (-not $bound) {
|
||||
Out-Line " [warn] Este intento no respondio; probando el siguiente..." Yellow
|
||||
# Show the actual reason from the log so the user can diagnose.
|
||||
if (Test-Path '.run\server.log') {
|
||||
$tail = Get-Content '.run\server.log' -Tail 6 -ErrorAction SilentlyContinue
|
||||
if ($tail) {
|
||||
Out-Line " (ultimas lineas del log):" DarkGray
|
||||
$tail | ForEach-Object { Out-Line " $_" DarkGray }
|
||||
# Show the actual reason from the logs so the user can diagnose.
|
||||
foreach ($logName in @('.run\server.err.log', '.run\server.log')) {
|
||||
if (Test-Path $logName) {
|
||||
$tail = Get-Content $logName -Tail 6 -ErrorAction SilentlyContinue
|
||||
if ($tail) {
|
||||
Out-Line " (ultimas lineas de $logName):" DarkGray
|
||||
$tail | ForEach-Object { Out-Line " $_" DarkGray }
|
||||
}
|
||||
}
|
||||
}
|
||||
try { Stop-Process -Id $proc.Id -Force -ErrorAction SilentlyContinue } catch {}
|
||||
|
||||
Reference in New Issue
Block a user