dart format should exit non-zero if the source code has errors
natebosch opened this issue · 5 comments
echo 'not dart' | dartfmt and echo 'not dart' | dart format both produce equivalent error messages, but dartfmt exits with code 65 while dart format exits with 0.
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 between stderr and stdout so using the output stream to determine success would take some additional hacking and running the command twice.
cc @munificent
@munificent we set the exit code based on the return value from runCommand. If you're setting the dart:io exitCode it'll be ignored.
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.