how to run node shelljs in sync mode and get stdout and stderr
<p>Within a nodejs script I have the following code which makes the call synchronously and returns the stdout from the shell script I am calling:</p>

<pre><code>var sh = require('shelljs');

... some code
var output = sh.exec('./someshellscript.sh', {silent:true}).stdout;
console.log(output);
... some more code (that shouldnt run until the script is complete)
</code></pre>

<p>I can also run the following script which will instead return the stderr:</p>

<pre><code>var sh = require('shelljs');

... some code
var output = sh.exec('./someshellscript.sh', {silent:true}).stderr;
console.log(output);
... some more code (that shouldnt run until the script is complete)
</code></pre>

<p>However I want to receive both stdout and stderr in a sync call. Its probably something pretty obvious I am missing herebut I cant work it out.</p>

<p>I think you used to be able run the following command in previous versions but this just returns undefined now:</p>

<pre><code>var sh = require('shelljs');

... some code
var output = sh.exec('./someshellscript.sh', {silent:true}).output;
console.log(output);
... some more code (that shouldnt run until the script is complete)
</code></pre>

<p>Relevant software versions are:</p>

<ul>
<li>Ubuntu: 14.04.3 LTS</li>
<li>node: 4.4.4</li>
<li>npm: 2.15.1</li>
<li>shelljs: 0.7.0</li>
</ul>

<p>Any help appreciated thanks.</p>