This commit is contained in:
1 parent
5faadcd6eb
commit
b77b272a5e
16 files changed
+280
-40
No files matched your search
@@ -6,7 +6,8 @@
|
||||
$ErrorActionPreference = 'Stop'
|
||||
$root = Split-Path -Parent $PSScriptRoot
|
||||
$runtime = Join-Path $root 'yunx-test'
|
||||
$logs = Join-Path $runtime 'log'
|
||||
$logs = Join-Path $root 'test-log\service-launch'
|
||||
# 控制台与热更新输出属于模拟部署测试记录,业务运行日志由程序按天管理。
|
||||
New-Item -ItemType Directory -Path $logs -Force | Out-Null
|
||||
$stamp = Get-Date -Format 'yyyyMMdd-HHmmss-fff'
|
||||
$previousRoot = $env:SMAIL_ROOT
|
||||
@@ -78,7 +79,7 @@ try {
|
||||
Start-Sleep -Seconds 3
|
||||
$process.Refresh()
|
||||
if ($process.HasExited) { throw "服务启动失败;标准输出:$stdout;错误日志:$stderr" }
|
||||
Write-Output "$Service 已启动,进程编号:$($process.Id);日志目录:yunx-test/log"
|
||||
Write-Output "$Service 已启动,进程编号:$($process.Id);运行日志:yunx-test/log;启动诊断:test-log/service-launch"
|
||||
Write-Output "运行文件:$binary;标准输出:$stdout;错误日志:$stderr"
|
||||
} finally {
|
||||
$env:SMAIL_ROOT = $previousRoot
|
||||
|
||||
@@ -23,12 +23,14 @@ foreach ($name in @('SMAIL_ROOT', 'SMAIL_HTTP_PORT_OVERRIDE', 'SMAIL_HTTP_TLS_MO
|
||||
try {
|
||||
$env:SMAIL_ROOT = $runtime
|
||||
$stamp = Get-Date -Format 'yyyyMMdd-HHmmss-fff'
|
||||
$logs = Join-Path $root 'test-log\service-launch'
|
||||
New-Item -ItemType Directory -Path $logs -Force | Out-Null
|
||||
$process = Start-Process -FilePath $binary -WorkingDirectory $runtime -WindowStyle Hidden -PassThru `
|
||||
-RedirectStandardOutput (Join-Path $runtime "log\production-$stamp.stdout.log") `
|
||||
-RedirectStandardError (Join-Path $runtime "log\production-$stamp.stderr.log")
|
||||
-RedirectStandardOutput (Join-Path $logs "production-$stamp.stdout.log") `
|
||||
-RedirectStandardError (Join-Path $logs "production-$stamp.stderr.log")
|
||||
Start-Sleep -Seconds 3
|
||||
$process.Refresh()
|
||||
if ($process.HasExited) { throw '生产模拟启动失败,请检查 yunx-test/log;不会自动豁免管理员恢复通道保护' }
|
||||
if ($process.HasExited) { throw '生产模拟启动失败,请检查 test-log/service-launch;不会自动豁免管理员恢复通道保护' }
|
||||
Write-Output "生产模拟已启动:$($process.Id),使用嵌入前端和 yunx-test 配置,管理员恢复通道保持保护。"
|
||||
} finally {
|
||||
foreach ($name in $previous.Keys) { [Environment]::SetEnvironmentVariable($name, $previous[$name], 'Process') }
|
||||
|
||||
Reference in new issue
Block a user