chore(dev): keep the detached dev-server start script
Running "npm run dev" as a tracked agent task gets the process killed when the runtime cap is reached, which leaves the machine with no dev server on port 6001. This script starts it with Start-Process so it survives session churn, and it refuses to start a second server when the port is already taken. The older .run-dev.ps1 in the same folder is broken and is replaced by this one: it invokes the Next binary without its extension, which PowerShell cannot execute, so node.exe is called explicitly instead.
This commit is contained in:
parent
cd0a818641
commit
dbcb378636
1 changed files with 30 additions and 0 deletions
30
Workflow/.start-dev-detached.ps1
Normal file
30
Workflow/.start-dev-detached.ps1
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
# Start the Workflow dev server fully detached from the agent session.
|
||||
#
|
||||
# WHY THIS FILE EXISTS
|
||||
# Running "npm run dev" as a tracked background task gets the process
|
||||
# killed when the runtime 3600000ms cap is reached (about 1 hour).
|
||||
# Start-Process detaches it, so it survives session churn.
|
||||
#
|
||||
# NOTE: the older .run-dev.ps1 in this folder is broken. It calls
|
||||
# & '.\node_modules\next\dist\bin\next'
|
||||
# but that path has no extension, so PowerShell cannot execute it.
|
||||
# node.exe must be invoked explicitly, which is what this script does.
|
||||
#
|
||||
# Usage: powershell -NoProfile -ExecutionPolicy Bypass -File .start-dev-detached.ps1
|
||||
|
||||
$ErrorActionPreference = 'Continue'
|
||||
|
||||
$root = 'C:\Users\SJ\.minimax-agent\projects\Workflow'
|
||||
$logFile = Join-Path $root '.dev-detached.log'
|
||||
|
||||
# Do not start a second server if one is already listening on 6001.
|
||||
$existing = (Get-NetTCPConnection -LocalPort 6001 -State Listen -ErrorAction SilentlyContinue).OwningProcess
|
||||
if ($existing) {
|
||||
Write-Host "Port 6001 already in use by PID $existing. Nothing to do."
|
||||
exit 0
|
||||
}
|
||||
|
||||
$proc = Start-Process -FilePath 'node.exe' -ArgumentList 'node_modules\next\dist\bin\next','dev','-p','6001' -WorkingDirectory $root -WindowStyle Hidden -RedirectStandardOutput $logFile -RedirectStandardError "$logFile.err" -PassThru
|
||||
|
||||
Write-Host "Workflow dev server started detached (PID $($proc.Id))."
|
||||
Write-Host "Log: $logFile"
|
||||
Loading…
Reference in a new issue