File tree Expand file tree Collapse file tree 2 files changed +17
-11
lines changed Expand file tree Collapse file tree 2 files changed +17
-11
lines changed Original file line number Diff line number Diff line change @@ -14,23 +14,27 @@ function cpu () {
1414}
1515
1616let family
17- if ( os ( ) === 'linux' ) {
18- const originalExclude = process . report . excludeNetwork
19- process . report . excludeNetwork = true
20- const report = process . report . getReport ( )
21- process . report . excludeNetwork = originalExclude
22- if ( report . header ?. glibcVersionRuntime ) {
23- family = 'glibc'
24- } else if ( Array . isArray ( report . sharedObjects ) && report . sharedObjects . some ( isMusl ) ) {
25- family = 'musl'
26- }
27- }
2817function libc ( osName ) {
2918 if ( osName !== 'linux' ) {
3019 return undefined
3120 }
21+ if ( family === undefined || process . report . forceCheck ) {
22+ const originalExclude = process . report . excludeNetwork
23+ process . report . excludeNetwork = true
24+ const report = process . report . getReport ( )
25+ process . report . excludeNetwork = originalExclude
26+ if ( report . header ?. glibcVersionRuntime ) {
27+ family = 'glibc'
28+ } else if ( Array . isArray ( report . sharedObjects ) && report . sharedObjects . some ( isMusl ) ) {
29+ family = 'musl'
30+ } else {
31+ family = null
32+ }
33+ }
3234 return family
3335}
36+ // Cache getReport straight away because of node bug https://github.com/nodejs/node/issues/55576
37+ libc ( os ( ) )
3438
3539function devEngines ( env = { } ) {
3640 const osName = env . os || os ( )
Original file line number Diff line number Diff line change 11const t = require ( 'tap' )
22const { checkPlatform } = require ( '..' )
3+ const process = require ( 'node:process' )
34
45t . test ( 'target cpu wrong' , async t =>
56 t . throws ( ( ) => checkPlatform ( {
@@ -106,6 +107,7 @@ t.test('libc', (t) => {
106107 let REPORT = { }
107108 const _processReport = process . report . getReport
108109 process . report . getReport = ( ) => REPORT
110+ process . report . forceCheck = true
109111
110112 t . teardown ( ( ) => {
111113 Object . defineProperty ( process , 'platform' , _processPlatform )
You can’t perform that action at this time.
0 commit comments