Skip to content

Instantly share code, notes, and snippets.

@lubert
Created May 27, 2016 02:55
Show Gist options
  • Save lubert/fade75ca3be6de6ec650daf1d8020b16 to your computer and use it in GitHub Desktop.
Save lubert/fade75ca3be6de6ec650daf1d8020b16 to your computer and use it in GitHub Desktop.
execPromise for casperjs
var require = patchRequire(require);
var cp = require('child_process');
var Q = require('q');
module.exports = function(cmd, args) {
var q = Q.defer();
cp.execFile(cmd, args, null, function(err, stdout, stderr) {
if (err) return q.reject(err);
return q.resolve(stdout, stderr);
});
return q.promise;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment