Skip to content

Commit 7860e3e

Browse files
committed
Use fs instead of globby
1 parent f2cb1b6 commit 7860e3e

2 files changed

Lines changed: 9 additions & 9 deletions

File tree

index.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
var binCheck = require('bin-check');
44
var binVersionCheck = require('bin-version-check');
55
var Download = require('download');
6-
var globby = require('globby');
6+
var fs = require('fs');
77
var osFilterObj = require('os-filter-obj');
88
var path = require('path');
99

@@ -119,7 +119,7 @@ BinWrapper.prototype.run = function (cmd, cb) {
119119
cmd = ['--version'];
120120
}
121121

122-
this.findExisting(function (err, files) {
122+
this.findExisting(function (err) {
123123
if (err) {
124124
cb(err);
125125
return;
@@ -170,18 +170,18 @@ BinWrapper.prototype.runCheck = function (cmd, cb) {
170170
*/
171171

172172
BinWrapper.prototype.findExisting = function (cb) {
173-
globby(this.path(), function (err, files) {
174-
if (err) {
175-
cb(err);
173+
fs.stat(this.path(), function (err) {
174+
if (err && err.code === 'ENOENT') {
175+
this.download(cb);
176176
return;
177177
}
178178

179-
if (!files.length) {
180-
this.download(cb);
179+
if (err) {
180+
cb(err);
181181
return;
182182
}
183183

184-
cb(null, files);
184+
cb();
185185
}.bind(this));
186186
};
187187

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
"bin-check": "^1.0.0",
2929
"bin-version-check": "^2.1.0",
3030
"download": "^4.0.0",
31-
"globby": "^1.0.0",
31+
"each-async": "^1.1.1",
3232
"os-filter-obj": "^1.0.0"
3333
},
3434
"devDependencies": {

0 commit comments

Comments
 (0)