Use shell.exec instead of shell.execSync

This commit is contained in:
Girish Ramakrishnan
2018-11-23 10:57:54 -08:00
parent cce03e250d
commit 9b4fffde29
6 changed files with 72 additions and 78 deletions

View File

@@ -3,7 +3,6 @@
exports = module.exports = {
spawn: spawn,
exec: exec,
execSync: execSync,
sudo: sudo,
sudoSync: sudoSync
};
@@ -16,20 +15,6 @@ var assert = require('assert'),
var SUDO = '/usr/bin/sudo';
function execSync(tag, cmd, callback) {
assert.strictEqual(typeof tag, 'string');
assert.strictEqual(typeof cmd, 'string');
debug(cmd);
try {
child_process.execSync(cmd, { stdio: 'inherit' });
} catch (e) {
if (callback) return callback(e);
throw e;
}
if (callback) callback();
}
function exec(tag, cmd, callback) {
assert.strictEqual(typeof tag, 'string');
assert.strictEqual(typeof cmd, 'string');
@@ -37,7 +22,7 @@ function exec(tag, cmd, callback) {
debug(`${tag} exec: ${cmd}`);
child_process.execSync(cmd, function (error, stdout, stderr) {
child_process.exec(cmd, function (error, stdout, stderr) {
debug(`${tag} (stdout): %s`, stdout.toString('utf8'));
debug(`${tag} (stderr): %s`, stderr.toString('utf8'));