26 lines
1.1 KiB
PowerShell
26 lines
1.1 KiB
PowerShell
# 后台启动 publish-release.ps1(tauri build 10 分钟级,run_command 600s 上限装不下)
|
||
# 用法: run_command 执行本文件 -> 立即返回 pid -> 之后轮询 release-out.log
|
||
$repo = 'E:\wk-lab\devflow'
|
||
$log = "$repo\target\release-out.log"
|
||
$errl = "$repo\target\release-err.log"
|
||
|
||
# 清掉上次 600s 超时可能残留的构建进程,防 cargo 构建锁互等
|
||
$killed = Get-Process cargo,cargo-tauri,rustc -ErrorAction SilentlyContinue
|
||
if ($killed) {
|
||
$killed | Stop-Process -Force
|
||
Write-Host ("清理残留构建进程: " + (($killed | Select-Object -ExpandProperty Id) -join ','))
|
||
} else {
|
||
Write-Host "无残留构建进程"
|
||
}
|
||
|
||
Remove-Item $log,$errl -ErrorAction SilentlyContinue
|
||
$p = Start-Process -FilePath 'powershell.exe' `
|
||
-ArgumentList @('-NoProfile','-ExecutionPolicy','Bypass','-File',"$repo\scripts\publish-release.ps1") `
|
||
-WorkingDirectory $repo `
|
||
-NoNewWindow `
|
||
-RedirectStandardOutput $log `
|
||
-RedirectStandardError $errl `
|
||
-PassThru
|
||
Set-Content -Path "$repo\target\release-pid.txt" -Value $p.Id -Encoding ascii
|
||
Write-Host "release started, pid=$($p.Id), log=$log"
|