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

Non-zero exit code on syntax error #1161

Closed
lassik opened this issue Jul 10, 2018 · 1 comment

Comments

@lassik
Copy link

commented Jul 10, 2018

What version of standard?

11.0.1

What operating system, Node.js, and npm version?

MacOS, Node.js 10.6.0, npm 6.1.0

What did you expect to happen?

I expected this shell command:

echo "(" | standard; echo "exit code is $?"

to say that the exit code is some number other than zero (because zero conventionally means success, whereas non-zero means failure). I believe it would be appropriate so that editor plugins and batch jobs don't try to use the output from stdout as if it were valid code.

What actually happened?

The exit code is zero (indicating success) even when there is a syntax error in the input.

@lassik

This comment has been minimized.

Copy link
Author

commented Jul 10, 2018

Sorry, my mistake. I neglected to use the --stdin flag so instead it tried to format a .js file that I happened to have in the current directory.

This works fine:

$ echo "(" | standard --stdin; echo "exit code is $?"
...
exit code is 1

and also with the --fix option:

$ echo "(" | standard --stdin --fix; echo "exit code is $?"
...
exit code is 1

@lassik lassik closed this Jul 10, 2018

@lock lock bot locked as resolved and limited conversation to collaborators Oct 8, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
1 participant
You can’t perform that action at this time.