15 lines
748 B
PowerShell
15 lines
748 B
PowerShell
# 发布产物冒烟:--snapshot 模式显示轮盘、导出 PNG 后自动退出
|
|
$ErrorActionPreference = 'Stop'
|
|
$exe = $args[0]
|
|
$outPng = $args[1]
|
|
if (-not (Test-Path $exe)) { throw "未找到: $exe" }
|
|
Remove-Item $outPng -ErrorAction SilentlyContinue
|
|
|
|
$v = (Get-Item $exe).VersionInfo
|
|
Write-Output ("版本信息: FileVersion={0} ProductVersion={1}" -f $v.FileVersion, $v.ProductVersion)
|
|
|
|
$p = Start-Process -FilePath $exe -ArgumentList @('--snapshot', $outPng) -PassThru
|
|
if (-not $p.WaitForExit(15000)) { Stop-Process -Id $p.Id -Force; throw '快照模式 15 秒未退出' }
|
|
Write-Output "退出码: $($p.ExitCode)"
|
|
Write-Output "快照已生成: $(Test-Path $outPng) ($(if (Test-Path $outPng) { (Get-Item $outPng).Length } else { 0 }) bytes)"
|