release: bump version to 0.75.2
ci / backend (push) Has been cancelled
ci / frontend (push) Has been cancelled
release / images (push) Has been cancelled
ci / delivery (push) Has been cancelled

This commit is contained in:
rayd1o committed 2026-09-25 02:03:53 +08:00
1 parent 003b316d42
commit a2025dbfe0
11 files changed
+105 -12

No files matched your search

+47
View File
@@ -78,3 +78,50 @@ try {
[IO.Path]::GetFileName($resolved) -notlike 'planet-launcher-tests-*') { throw 'Unsafe cleanup path' }
Remove-Item -LiteralPath $resolved -Recurse -Force
}
function Get-Command {
param([string]$Name, [string]$CommandType, [string]$ErrorAction)
if ($script:AvailableLaunchCommands.ContainsKey($Name)) {
return [pscustomobject]@{ Source = $script:AvailableLaunchCommands[$Name] }
}
}
$pwshPath = 'C:\Program Files\PowerShell\7\pwsh.exe'
$terminalPath = 'C:\Users\Test\AppData\Local\Microsoft\WindowsApps\wt.exe'
$legacyPath = 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe'
foreach ($hasTerminal in @($true, $false)) {
foreach ($hasPwsh in @($true, $false)) {
$script:AvailableLaunchCommands = @{ 'powershell.exe' = $legacyPath }
if ($hasTerminal) { $script:AvailableLaunchCommands['wt.exe'] = $terminalPath }
if ($hasPwsh) { $script:AvailableLaunchCommands['pwsh.exe'] = $pwshPath }
$launch = Get-PlanetTerminalLaunch 'TESTPAYLOAD'
$expectedShell = if ($hasPwsh) { $pwshPath } else { $legacyPath }
$expectedExecutable = if ($hasTerminal) { $terminalPath } else { $expectedShell }
Assert-Equal $expectedExecutable $launch.FilePath 'Terminal/shell priority'
if ($hasTerminal -and -not $launch.ArgumentList.Contains('"' + $expectedShell + '"')) {
throw 'Terminal shell path must be quoted, including Program Files paths'
}
if ($launch.ArgumentList -notmatch '-EncodedCommand TESTPAYLOAD$') {
throw 'Encoded bootstrap was not preserved'
}
}
}
function Test-PlanetAdministrator { return $script:IsTestAdministrator }
function Start-Process {
param($FilePath, $ArgumentList, $WindowStyle, $Verb)
$script:CapturedLaunch = @{ FilePath = $FilePath; ArgumentList = $ArgumentList; Verb = $Verb }
$script:LaunchCount++
}
$script:AvailableLaunchCommands = @{ 'pwsh.exe' = $pwshPath; 'wt.exe' = $terminalPath }
$script:LaunchCount = 0
foreach ($isAdmin in @($false, $true)) {
$script:IsTestAdministrator = $isAdmin
Start-PlanetRestart $target
Assert-Equal $terminalPath $script:CapturedLaunch.FilePath 'Admin and ordinary entry both use Terminal'
if ($isAdmin -and $script:CapturedLaunch.Verb) { throw 'Already elevated entry must not request UAC again' }
if (-not $isAdmin) { Assert-Equal 'RunAs' $script:CapturedLaunch.Verb 'Ordinary entry requires elevation' }
}
$script:IsTestAdministrator = $false
try { Start-PlanetRestart $target -AlreadyElevated; throw 'Unelevated child accepted' }
catch { if ($_.Exception.Message -ne 'Administrator elevation was not granted.') { throw } }
Assert-Equal 2 $script:LaunchCount 'Child must not recursively launch more windows'
Write-Host 'PASS: Terminal/PowerShell priority, quoted paths, elevation and no recursive dispatch'