shell: add options to exec

This commit is contained in:
Girish Ramakrishnan
2024-02-20 21:11:09 +01:00
parent 7ce5b53753
commit 26eb739b46
9 changed files with 45 additions and 44 deletions
+3 -2
View File
@@ -21,14 +21,15 @@ exports = module.exports = {
const SUDO = '/usr/bin/sudo';
function exec(tag, cmd, callback) {
function exec(tag, cmd, options, callback) {
assert.strictEqual(typeof tag, 'string');
assert.strictEqual(typeof cmd, 'string');
assert.strictEqual(typeof options, 'object');
assert.strictEqual(typeof callback, 'function');
debug(`${tag} exec: ${cmd}`);
child_process.exec(cmd, function (error, stdout, stderr) {
child_process.exec(cmd, options, function (error, stdout, stderr) {
const stdoutResult = stdout ? stdout.toString('utf8') : null;
const stderrResult = stderr ? stderr.toString('utf8') : null;