





















@@ -252,6 +252,9 @@ describe("install.ps1 failure handling", () => {
252252expect(ensureGitBody).toContain("Ensure-PortableGitOnUserPath");
253253expect(portableGitPathBody).toContain("Add-ToUserPath $pathEntry");
254254expect(portableGitPathBody).toContain("git-backed updates");
255+expect(portableArchitectureBody).toContain("Win32_Processor");
256+expect(portableArchitectureBody).toContain("Architecture -eq 12");
257+expect(portableArchitectureBody).toContain("Win32_ComputerSystem");
255258expect(portableArchitectureBody).toContain("PROCESSOR_ARCHITEW6432");
256259expect(portableArchitectureBody).toContain("PROCESSOR_ARCHITECTURE");
257260expect(portableGitDownloadBody).toContain("Get-WindowsPortableArchitecture");
@@ -301,6 +304,61 @@ describe("install.ps1 failure handling", () => {
301304expect(result.stderr).toBe("");
302305});
303306307+runIfPowerShell("selects native ARM64 downloads when x64 PowerShell is emulated", () => {
308+const tempDir = harness.createTempDir("openclaw-install-ps1-");
309+const scriptPath = join(tempDir, "install.ps1");
310+const scriptWithoutEntryPoint = source.replace(ENTRYPOINT_RE, "");
311+writeFileSync(
312+scriptPath,
313+[
314+scriptWithoutEntryPoint,
315+"",
316+"$env:PROCESSOR_ARCHITEW6432 = $null",
317+"$env:PROCESSOR_ARCHITECTURE = 'AMD64'",
318+"function Get-CimInstance {",
319+" [CmdletBinding()]",
320+" param([string]$ClassName)",
321+" if ($ClassName -eq 'Win32_Processor') { return [pscustomobject]@{ Architecture = 12; Name = 'Cobalt 100' } }",
322+" if ($ClassName -eq 'Win32_ComputerSystem') { return [pscustomobject]@{ SystemType = 'ARM64-based PC' } }",
323+' throw "Unexpected CIM class $ClassName"',
324+"}",
325+"function Invoke-RestMethod {",
326+" param([string]$Uri, [object]$Headers)",
327+" if ($Uri -eq 'https://nodejs.org/dist/index.json') {",
328+" return @(",
329+" [pscustomobject]@{ version = 'v24.17.0'; files = @('win-arm64-zip', 'win-x64-zip') }",
330+" )",
331+" }",
332+" [pscustomobject]@{",
333+" tag_name = 'v2.54.0.windows.1'",
334+" assets = @(",
335+" [pscustomobject]@{ name = 'MinGit-2.54.0-64-bit.zip'; browser_download_url = 'https://example.test/x64.zip' },",
336+" [pscustomobject]@{ name = 'MinGit-2.54.0-arm64.zip'; browser_download_url = 'https://example.test/arm64.zip' }",
337+" )",
338+" }",
339+"}",
340+"$nodeDownload = Resolve-PortableNodeDownload",
341+"if ($nodeDownload.Name -ne 'node-v24.17.0-win-arm64.zip') { throw \"NodeName=$($nodeDownload.Name)\" }",
342+"$gitDownload = Resolve-PortableGitDownload",
343+"if ($gitDownload.Name -ne 'MinGit-2.54.0-arm64.zip') { throw \"GitName=$($gitDownload.Name)\" }",
344+"",
345+].join("\n"),
346+);
347+chmodSync(scriptPath, 0o755);
348+349+const result = runPowerShell([
350+"-NoLogo",
351+"-NoProfile",
352+"-ExecutionPolicy",
353+"Bypass",
354+"-File",
355+scriptPath,
356+]);
357+358+expect(result.status).toBe(0);
359+expect(result.stderr).toBe("");
360+});
361+304362it("activates the repo-pinned pnpm version for git installs", () => {
305363const pnpmVersionBody = extractFunctionBody(source, "Get-RepoPnpmVersion");
306364const pnpmVersionMatchBody = extractFunctionBody(source, "Test-PnpmCommandMatchesVersion");
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。