Skip to content

Commit

Permalink
Upgrade to the latest version of detect-libc
Browse files Browse the repository at this point in the history
libc family detection uses the non-blocking Report API where
available (Node.js 12+) otherwise spawns a single child process
  • Loading branch information
lovell committed Jan 19, 2022
1 parent 40a83f2 commit e6df119
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 16 deletions.
2 changes: 1 addition & 1 deletion lib/util/versioning.js
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,7 @@ module.exports.evaluate = function(package_json, options, napi_build_version) {
target_platform: options.target_platform || process.platform,
arch: options.target_arch || process.arch,
target_arch: options.target_arch || process.arch,
libc: options.target_libc || detect_libc.family || 'unknown',
libc: options.target_libc || detect_libc.familySync() || 'unknown',

This comment has been minimized.

Copy link
@joyrexus

joyrexus Apr 13, 2022

This is invoking detect_libc.familySync() rather than referencing it.

image

This comment has been minimized.

Copy link
@lovell

lovell Apr 15, 2022

Author Contributor

@joyrexus This is the intentional and correct behaviour. Please check/verify the version of detect-libc.

module_main: package_json.main,
toolset: options.toolset || '', // address https://github.com/mapbox/node-pre-gyp/issues/119
bucket: package_json.binary.bucket,
Expand Down
23 changes: 10 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"bin": "./bin/node-pre-gyp",
"main": "./lib/node-pre-gyp.js",
"dependencies": {
"detect-libc": "^1.0.3",
"detect-libc": "^2.0.0",
"https-proxy-agent": "^5.0.0",
"make-dir": "^3.1.0",
"node-fetch": "^2.6.5",
Expand Down
2 changes: 1 addition & 1 deletion test/versioning.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ test('should detect libc', (t) => {
}
};
const opts = versioning.evaluate(mock_package_json, { module_root: '/root' });
const expected_libc_token = detect_libc.family || 'unknown';
const expected_libc_token = detect_libc.familySync() || 'unknown';
t.comment('performing test with the following libc token: ' + expected_libc_token);
t.equal(opts.module_path, path.normalize('/root/lib/binding/test-' + expected_libc_token));
t.equal(opts.module, path.normalize('/root/lib/binding/test-' + expected_libc_token + '/test.node'));
Expand Down

0 comments on commit e6df119

Please sign in to comment.