-
Notifications
You must be signed in to change notification settings - Fork 125
dart format should exit non-zero if the source code has errors #1035
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
Comments
cc @munificent |
@munificent we set the exit code based on the return value from |
munificent
added a commit
that referenced
this issue
Jun 18, 2021
It reads from stdin asynchronously. Before this fix, the FormatCommand did not wait for that to complete before returning the exit code, so it would return before stdin had been formatted and any parse error detected. Fix #1035.
This is fixed in the dart_style repo, but I'm going to keep this issue open until I've rolled the fix into the SDK. |
This is in the SDK and published now. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
echo 'not dart' | dartfmt
andecho 'not dart' | dart format
both produce equivalent error messages, butdartfmt
exits with code65
whiledart format
exits with0
.We use the exit code in
dart-vim-plugin
to know whether the output should be treated as the formatted file, or as errors. Unfortunately in vim it isn't trivial to distinguish betweenstderr
andstdout
so using the output stream to determine success would take some additional hacking and running the command twice.The text was updated successfully, but these errors were encountered: