26 lines
878 B
PowerShell
26 lines
878 B
PowerShell
param(
|
|
[Parameter(Mandatory=$true)][string]$GateName,
|
|
[Parameter(Mandatory=$true)][string[]]$CargoArgs
|
|
)
|
|
$ErrorActionPreference = 'Stop'
|
|
. (Join-Path $PSScriptRoot 'toolchain\env.ps1')
|
|
$gateLog = Join-Path $PSScriptRoot ($GateName + '.log')
|
|
$gateStatus = Join-Path $PSScriptRoot ($GateName + '-status.json')
|
|
$gateStart = [DateTime]::UtcNow
|
|
$gateTimer = [Diagnostics.Stopwatch]::StartNew()
|
|
& cargo @CargoArgs *> $gateLog
|
|
$gateExit = $LASTEXITCODE
|
|
$gateTimer.Stop()
|
|
@{
|
|
name = $GateName
|
|
command = @('cargo') + $CargoArgs
|
|
started_utc = $gateStart.ToString('o')
|
|
completed_utc = [DateTime]::UtcNow.ToString('o')
|
|
seconds = $gateTimer.Elapsed.TotalSeconds
|
|
exit = $gateExit
|
|
log = $gateLog
|
|
} | ConvertTo-Json -Depth 3 | Set-Content -LiteralPath $gateStatus
|
|
Get-Content -LiteralPath $gateStatus
|
|
Get-Content -LiteralPath $gateLog -Tail 16
|
|
exit $gateExit
|