$ErrorActionPreference = "Stop" Remove-Item -Force out.log -ErrorAction SilentlyContinue $p = Start-Process -FilePath node -ArgumentList 'src/index.js' -WorkingDirectory (Get-Location).Path -RedirectStandardOutput 'out.log' -RedirectStandardError 'out.log' -PassThru Start-Sleep -Seconds 30 Stop-Process -Id $p.Id -Force Start-Sleep -Seconds 1 Add-Content -Path out.log -Value "[runner] stopped after 30s"