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 () {
14
14
}
15
15
16
16
let 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
- }
28
17
function libc ( osName ) {
29
18
if ( osName !== 'linux' ) {
30
19
return undefined
31
20
}
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
+ }
32
34
return family
33
35
}
36
+ // Cache getReport straight away because of node bug https://github.com/nodejs/node/issues/55576
37
+ libc ( os ( ) )
34
38
35
39
function devEngines ( env = { } ) {
36
40
const osName = env . os || os ( )
Original file line number Diff line number Diff line change 1
1
const t = require ( 'tap' )
2
2
const { checkPlatform } = require ( '..' )
3
+ const process = require ( 'node:process' )
3
4
4
5
t . test ( 'target cpu wrong' , async t =>
5
6
t . throws ( ( ) => checkPlatform ( {
@@ -106,6 +107,7 @@ t.test('libc', (t) => {
106
107
let REPORT = { }
107
108
const _processReport = process . report . getReport
108
109
process . report . getReport = ( ) => REPORT
110
+ process . report . forceCheck = true
109
111
110
112
t . teardown ( ( ) => {
111
113
Object . defineProperty ( process , 'platform' , _processPlatform )
You can’t perform that action at this time.
0 commit comments