-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
18 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -400,12 +400,16 @@ export async function runVersion(locator: Locator, installSpec: InstallSpec & {s | |
if (!binPath) | ||
throw new Error(`Assertion failed: Unable to locate path for bin '${binName}'`); | ||
|
||
// Node.js segfaults when using npm@>=9.7.0 and v8-compile-cache | ||
// $ docker run -it node:20.3.0-slim corepack [email protected] --version | ||
// [SIGSEGV] | ||
if (locator.name !== `npm` || semverLt(locator.reference, `9.7.0`)) | ||
// @ts-expect-error - No types | ||
await import(`v8-compile-cache`); | ||
// @ts-expect-error - Missing types | ||
if (!Module.enableCompileCache) { | ||
// Node.js segfaults when using npm@>=9.7.0 and v8-compile-cache | ||
// $ docker run -it node:20.3.0-slim corepack [email protected] --version | ||
// [SIGSEGV] | ||
if (locator.name !== `npm` || semverLt(locator.reference, `9.7.0`)) { | ||
// @ts-expect-error - No types | ||
await import(`v8-compile-cache`); | ||
} | ||
} | ||
|
||
// We load the binary into the current process, | ||
// while making it think it was spawned. | ||
|
@@ -429,6 +433,12 @@ export async function runVersion(locator: Locator, installSpec: InstallSpec & {s | |
// Use nextTick to unwind the stack, and consequently remove Corepack from | ||
// the stack trace of the package manager. | ||
process.nextTick(Module.runMain, binPath); | ||
|
||
// @ts-expect-error - No types | ||
if (Module.flushCompileCache) { | ||
// @ts-expect-error - No types | ||
setImmediate(Module.flushCompileCache); | ||
} | ||
} | ||
|
||
export function shouldSkipIntegrityCheck() { | ||
|