5

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?

Douglas Ludlow
  • 10,754
  • 6
  • 30
  • 54

1 Answers1

7

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 for echo() calls. Default is false.

Douglas Ludlow
  • 10,754
  • 6
  • 30
  • 54