When I run the following code in node:
var shell = require('shelljs');
var files = shell.ls('-R', './**/foobar');
console.log('Files found:\n' + files.join('\n'));
I see this in the output:
ls: no such file or directory: ./**/foobar
How can I suppress the stderr, keep it from being shown?
Took me a bit to figure this out, but you need to configure shelljs to be silent, like so:
var shell = require('shelljs');
shell.config.silent = true;
From the README, this:
Suppresses all command output if
true
, except forecho()
calls. Default isfalse
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With