Comparing version 0.0.1 to 0.0.2
@@ -1,7 +0,9 @@ | ||
var exec = require('child_process').exec; | ||
var cp = require('child_process'); | ||
module.exports = function whereis(name, cb) { | ||
exec('which ' + name, function(error, stdout, stderr) { | ||
cp.exec('which ' + name, function(error, stdout, stderr) { | ||
stdout = stdout.split('\n')[0]; | ||
if (error || stderr || stdout === '' || stdout.charAt(0) !== '/') { | ||
exec('whereis ' + name, function(error, stdout, stderr) { | ||
stdout = stdout.split('\n')[0]; | ||
cp.exec('whereis ' + name, function(error, stdout, stderr) { | ||
if (error || stderr || stdout === '' || stdout.indexOf('/') === -1) { | ||
@@ -19,1 +21,2 @@ return cb(new Error('Could not find ' + name + ' or system not supported')); | ||
{ | ||
"name": "whereis", | ||
"version": "0.0.1", | ||
"version": "0.0.2", | ||
"author": "Vincent Voyer vincent.voyer@gmail.com", | ||
@@ -14,3 +14,9 @@ "description": "Which/Whereis easy helper, find if a program exists", | ||
], | ||
"repository": "git://github.com/vvo/node-whereis.git" | ||
"repository": "git://github.com/vvo/node-whereis.git", | ||
"devDependencies": { | ||
"tap": "~0.3.0" | ||
}, | ||
"scripts": { | ||
"test": "node test" | ||
} | ||
} |
node-whereis | ||
============ | ||
Simply get the first path to a bin on any system | ||
Simply get the first path to a bin on any system | ||
```js | ||
var whereis = require('whereis'); | ||
whereis('wget', function(err, path) { | ||
console.log(path); | ||
}); | ||
// /usr/bin/wget | ||
``` |
2299
5
54
13
1
2