@@ -3,7 +3,10 @@ import fs from "node:fs/promises";
|
3 | 3 | import path from "node:path"; |
4 | 4 | import { PassThrough } from "node:stream"; |
5 | 5 | import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; |
6 | | -import { getWindowsCmdExePath } from "../infra/windows-install-roots.js"; |
| 6 | +import { |
| 7 | +getWindowsCmdExePath, |
| 8 | +getWindowsPowerShellExePath, |
| 9 | +} from "../infra/windows-install-roots.js"; |
7 | 10 | import "./test-helpers/schtasks-base-mocks.js"; |
8 | 11 | import { |
9 | 12 | inspectPortUsage, |
@@ -136,7 +139,11 @@ function makeSpawnSyncResult(overrides: Partial<SpawnSyncResult> = {}): SpawnSyn
|
136 | 139 | function mockWindowsNodeHostProcess(processId = 5151): void { |
137 | 140 | vi.spyOn(process, "platform", "get").mockReturnValue("win32"); |
138 | 141 | spawnSync.mockImplementation((command, args) => { |
139 | | -if (command === "powershell" && Array.isArray(args) && args.includes(NODE_PROCESS_QUERY)) { |
| 142 | +if ( |
| 143 | +command === getWindowsPowerShellExePath() && |
| 144 | +Array.isArray(args) && |
| 145 | +args.includes(NODE_PROCESS_QUERY) |
| 146 | +) { |
140 | 147 | return makeSpawnSyncResult({ |
141 | 148 | stdout: JSON.stringify([ |
142 | 149 | { |
@@ -405,7 +412,7 @@ describe("Windows startup fallback", () => {
|
405 | 412 | findVerifiedGatewayListenerPidsOnPortSync.mockReturnValue([4242]); |
406 | 413 | spawnSync.mockImplementation((command, args) => { |
407 | 414 | if ( |
408 | | -command === "powershell" && |
| 415 | +command === getWindowsPowerShellExePath() && |
409 | 416 | Array.isArray(args) && |
410 | 417 | args.includes( |
411 | 418 | "Get-CimInstance Win32_Process | Select-Object ProcessId,CommandLine | ConvertTo-Json -Compress", |
@@ -475,7 +482,7 @@ describe("Windows startup fallback", () => {
|
475 | 482 | fastForwardTaskStartWait(); |
476 | 483 | spawnSync.mockImplementation((command, args) => { |
477 | 484 | if ( |
478 | | -command === "powershell" && |
| 485 | +command === getWindowsPowerShellExePath() && |
479 | 486 | Array.isArray(args) && |
480 | 487 | args.includes( |
481 | 488 | "Get-CimInstance Win32_Process | Select-Object ProcessId,CommandLine | ConvertTo-Json -Compress", |
@@ -563,7 +570,7 @@ describe("Windows startup fallback", () => {
|
563 | 570 | ); |
564 | 571 | spawnSync.mockImplementation((command, args) => { |
565 | 572 | if ( |
566 | | -command === "powershell" && |
| 573 | +command === getWindowsPowerShellExePath() && |
567 | 574 | Array.isArray(args) && |
568 | 575 | args.includes( |
569 | 576 | "Get-CimInstance Win32_Process | Select-Object ProcessId,CommandLine | ConvertTo-Json -Compress", |
|