This commit is contained in:
吴杨帆 2026-05-31 01:23:29 -04:00 committed by GitHub
commit 869274d26c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 6 additions and 6 deletions

View file

@ -641,9 +641,9 @@ export function createPackageManagerInvocation(args: string[], env: NodeJS.Proce
return createCommandInvocation({ args, command: execPath, env });
}
if (process.platform === "win32") {
return buildCmdShimInvocation("pnpm", args, env);
return buildCmdShimInvocation("corepack", ["pnpm", ...args], env);
}
return { args, command: "pnpm" };
return { args: ["pnpm", ...args], command: "corepack" };
}
function createLoggedStdio(logFd?: number | null): StdioOptions {

View file

@ -693,13 +693,13 @@ describe("createPackageManagerInvocation", () => {
]);
});
it("returns plain pnpm invocation on POSIX without npm_execpath", () => {
it("returns corepack pnpm invocation on POSIX without npm_execpath", () => {
setPlatform("linux");
const invocation = createPackageManagerInvocation(["install"], {} as NodeJS.ProcessEnv);
expect(invocation).toEqual({ args: ["install"], command: "pnpm" });
expect(invocation).toEqual({ args: ["pnpm", "install"], command: "corepack" });
});
it("wraps pnpm through cmd.exe with verbatim arguments on Windows", () => {
it("wraps corepack pnpm through cmd.exe with verbatim arguments on Windows", () => {
setPlatform("win32");
const invocation = createPackageManagerInvocation(["--filter", "@open-design/desktop", "build"], {
ComSpec: "cmd.exe",
@ -710,7 +710,7 @@ describe("createPackageManagerInvocation", () => {
"/d",
"/s",
"/c",
'"pnpm --filter @open-design/desktop build"',
'"corepack pnpm --filter @open-design/desktop build"',
]);
});
});