From 8935b2f3d592bf74553082a6b0504f34df6d7fc7 Mon Sep 17 00:00:00 2001 From: Artur Adib Date: Wed, 21 Mar 2012 18:20:04 -0400 Subject: [PATCH] exec({silent}) overrides silent() --- shell.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/shell.js b/shell.js index 01b1d5a..6c754b1 100644 --- a/shell.js +++ b/shell.js @@ -793,7 +793,7 @@ function _exec(command, options, callback) { } options = extend({ - silent: false, + silent: state.silent, async: false }, options); @@ -1194,7 +1194,8 @@ function tempDir() { // Wrapper around exec() to enable echoing output to console in real time function execAsync(cmd, opts, callback) { - var output = ''; + var output = '', + silent = 'silent' in opts ? opts.silent : state.silent; var c = child.exec(cmd, {env: process.env}, function(err) { if (callback) @@ -1203,13 +1204,13 @@ function execAsync(cmd, opts, callback) { c.stdout.on('data', function(data) { output += data; - if (!opts.silent) + if (!silent) write(data); }); c.stderr.on('data', function(data) { output += data; - if (!opts.silent) + if (!silent) write(data); }); } @@ -1226,13 +1227,13 @@ function execSync(cmd, opts) { sleepFile = path.resolve(tempDir()+'/'+randomFileName()); var options = extend({ - silent: false + silent: state.silent }, opts); var previousStdoutContent = ''; // Echoes stdout changes from running process, if not silent function updateStdout() { - if (state.silent || options.silent || !fs.existsSync(stdoutFile)) + if (options.silent || !fs.existsSync(stdoutFile)) return; var stdoutContent = fs.readFileSync(stdoutFile, 'utf8');