Skip to content

Instantly share code, notes, and snippets.

@icodeforlove
Created April 12, 2013 17:59
Show Gist options
  • Select an option

  • Save icodeforlove/5373877 to your computer and use it in GitHub Desktop.

Select an option

Save icodeforlove/5373877 to your computer and use it in GitHub Desktop.
node system command check
var spawn = require('child_process').spawn;
function doesCommandExist (command, callback) {
var child = spawn('type', [command]);
child.on('close', function (code) {
callback(!code);
});
}
doesCommandExist('compass', function (exists) {
console.log(exists);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment