-
Notifications
You must be signed in to change notification settings - Fork 739
Closed
Description
Node version (or tell us if you're using electron or some other framework):
v8.11.3
ShellJS version (the most recent version/Github branch you see the bug on):
0.8.2
Operating system:
Mac OS X
Description of the bug:
There doesn't seem to be a way to suppress stdout from echo()
even when redirecting to another command / pipe.
Based on the code, it seems like no matter what, the call to sys.stdout.write()
will happen.
Lines 58 to 60 in 4bd22e7
process.stdout.write(output); | |
return output; |
Example ShellJS command to reproduce the error:
(given a file testfile
without the string asdfasdf at the beginning of a line):
const shell = require('shelljs');
if (!shell.grep(/^asdfasdf/, 'testfile').stdout.trim()) {
shell.echo({silent: true}, 'asdfasdf').toEnd('testfile');
}
In this case, whether {silent: true}
(which it seems like it's supposed to be parsed, tho not do anything, based on
Lines 38 to 40 in 4bd22e7
}, { | |
silent: true, | |
}); |
testfile
. Also, in this case, {silent: true}
gets added to the file as well.
const shell = require('shelljs');
if (!shell.grep(/^asdfasdf/, 'testfile').stdout.trim()) {
shell.config.silent = true;
shell.echo('asdfasdf').toEnd('testfile');
}
The above code also doesn't suppress stdout.
Metadata
Metadata
Assignees
Labels
No labels