Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

Commit

Permalink
fix: the getBinaryPath function only need to execute once enough (#…
Browse files Browse the repository at this point in the history
…2620)

* fix: the function only need to execute once enough

* fix: typo `;`
  • Loading branch information
givingwu authored and xzyfer committed Nov 9, 2019
1 parent ac145b1 commit 7293699
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/binding.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,15 @@ var errors = require('./errors');
* Require binding
*/
module.exports = function(ext) {
if (!ext.hasBinary(ext.getBinaryPath())) {
var binaryPath = ext.getBinaryPath();

if (!ext.hasBinary(binaryPath)) {
if (!ext.isSupportedEnvironment()) {
throw new Error(errors.unsupportedEnvironment());
} else {
throw new Error(errors.missingBinary());
}
}

return require(ext.getBinaryPath());
return require(binaryPath);
};

0 comments on commit 7293699

Please sign in to comment.