Skip to content

Instantly share code, notes, and snippets.

@shaharkazaz
Last active January 17, 2020 12:39
Show Gist options
  • Select an option

  • Save shaharkazaz/57e5ecaf8776911e7c5bcc9a6e01d377 to your computer and use it in GitHub Desktop.

Select an option

Save shaharkazaz/57e5ecaf8776911e7c5bcc9a6e01d377 to your computer and use it in GitHub Desktop.
const shell = require('shelljs');
function exec(cmd, options) {
const defaultOptions = {silent: true};
let output = shell.exec(cmd, {...defaultOptions, ...(options || {})});
if (options && options.toString !== false) {
output = output.toString();
output = options.trim ? output.trim() : output;
}
return output;
}
exports.exec = exec;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment