fix: 完成商务迁移复核与接口优化并清理历史资料
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
param(
|
||||
[Parameter(Mandatory = $true)][string]$RuntimePath,
|
||||
[string]$ConfigName = 'config-next.yaml',
|
||||
[string]$BinaryPath = '.cache/sw89/sw-new-complete.exe'
|
||||
)
|
||||
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$workspaceRoot = (Resolve-Path (Join-Path $PSScriptRoot '..')).Path
|
||||
$runtimeRoot = (Resolve-Path -LiteralPath $RuntimePath).Path
|
||||
$configPath = (Resolve-Path -LiteralPath (Join-Path $runtimeRoot $ConfigName)).Path
|
||||
if (-not [System.IO.Path]::IsPathRooted($BinaryPath)) {
|
||||
$BinaryPath = Join-Path $workspaceRoot $BinaryPath
|
||||
}
|
||||
$binary = (Resolve-Path -LiteralPath $BinaryPath).Path
|
||||
$compat = Get-Content -LiteralPath (Join-Path $runtimeRoot 'sdk-compatibility.json') -Raw | ConvertFrom-Json
|
||||
$previous = @{}
|
||||
$settings = @{
|
||||
SW_SDK_AUTH_CODE = $compat.AUTH_CODE
|
||||
SW_SDK_MIGRATE_AUTH_CODE = $compat.MIGRATE_AUTH_CODE
|
||||
SW_SDK_TABLE_PREFIX = $compat.TABLE_PREFIX
|
||||
}
|
||||
try {
|
||||
foreach ($name in $settings.Keys) {
|
||||
$previous[$name] = [Environment]::GetEnvironmentVariable($name, 'Process')
|
||||
[Environment]::SetEnvironmentVariable($name, $settings[$name], 'Process')
|
||||
}
|
||||
$process = Start-Process -FilePath $binary -ArgumentList @('-conf', ('"' + $configPath + '"')) `
|
||||
-WorkingDirectory $workspaceRoot -WindowStyle Hidden `
|
||||
-RedirectStandardOutput (Join-Path $runtimeRoot 'rehearsal.stdout.log') `
|
||||
-RedirectStandardError (Join-Path $runtimeRoot 'rehearsal.stderr.log') -PassThru
|
||||
$process.Id | Set-Content -LiteralPath (Join-Path $runtimeRoot 'rehearsal.pid')
|
||||
Write-Output "Rehearsal process: $($process.Id)"
|
||||
} finally {
|
||||
foreach ($name in $previous.Keys) {
|
||||
[Environment]::SetEnvironmentVariable($name, $previous[$name], 'Process')
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user