Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shelljs print stderr to console even if exec-only "silent" is true #905

Closed
solominsn opened this issue Nov 12, 2018 · 8 comments
Closed

Shelljs print stderr to console even if exec-only "silent" is true #905

solominsn opened this issue Nov 12, 2018 · 8 comments
Labels
duplicate fix

Comments

@solominsn
Copy link

@solominsn solominsn commented Nov 12, 2018

Node version (or tell us if you're using electron or some other framework):

6.14.x, but it doesn't matter

ShellJS version (the most recent version/Github branch you see the bug on):

0.8.2

Operating system:

Debian 10

Description of the bug:

Bug #887 has been closed, but it's a real bug. Exec-only "silent" option is not passed to helper function (common.error) which check error code and write stderr to console. Changing global config "silent" to false is only way to suppress stderr printing. If required fix can be prepared and pushed.

Example ShellJS command to reproduce the error:

shell.exec('npm run invalid-command', { silent: true });

Invalid command returns non-zero error code and shelljs print stderr to console.

@solominsn
Copy link
Author

@solominsn solominsn commented Nov 12, 2018

Already fixed in the master, not in npm.

@nfischer
Copy link
Member

@nfischer nfischer commented Nov 13, 2018

Yup, this is handled. I'll cut a release soon.

@koraa
Copy link

@koraa koraa commented Jan 4, 2019

@solominsn Thanks a lot for fixing this issue!
I just ran into this…can we have a release please? ^^

@koraa
Copy link

@koraa koraa commented Jan 4, 2019

Is there an option on master to keep the current behavior of printing the output only on error?
Something like {silent: true, printOnError: true}?

@nfischer
Copy link
Member

@nfischer nfischer commented Jan 5, 2019

I just ran into this…can we have a release please? ^^

This was fixed in #892 (which made it into v0.8.3. I just updated the changelog to reflect this.

@nfischer
Copy link
Member

@nfischer nfischer commented Jan 5, 2019

Is there an option on master to keep the current behavior of printing the output only on error?
Something like {silent: true, printOnError: true}?

No such option, unfortunately. If you want this behavior only for exec(), you could implement it as:

const ret = shell.exec(cmd, { silent: true });
process.stdout.write(ret.stdout);

// or
const c = shell.exec(cmd, { silent: true, async: true });
c.stdout.on('data', data => {
  process.stdout.write(data);
});

Edit: accidentally clicked "submit" before I was finished typing. Apologies.

@nfischer
Copy link
Member

@nfischer nfischer commented Jan 9, 2019

Re-closing (I think I reopened accidentally, sorry). Filed the request as #927

@nfischer nfischer closed this as completed Jan 9, 2019
@nfischer nfischer added duplicate fix labels Jan 9, 2019
@nfischer
Copy link
Member

@nfischer nfischer commented Jan 9, 2019

For tracking, this is a duplicate of #851

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate fix
Projects
None yet
Development

No branches or pull requests

3 participants