project-cemetery/lefthook

Blank output and unexpected successful command

Opened this issue ยท 3 comments

Hi! ๐Ÿ‘‹

While trying out this package, I noticed that outputs from commands such as flutter format, flutter analyze and flutter test are not displayed because even though result.exitCode is 1, the output is in result.stdout instead of result.stderr. Therefore, we get a blank output.

Also, if result.exitCode is 1, I think it should be propagated/forwared, so whatever command you ran will fail. Currently, if I ran git push in a repo with failing test or invalid syntax, I won't see any output and the command will succeed.

I've tried an approach to solve this and can send a PR if you agree with the points above.

Example repo: https://github.com/arthurdenner/lefthook_error_example

In the repo above, the last commit should've failed, but it didn't.

Screenshot 2020-04-10 at 16 15 06

I can confirm.

pre-commit with flutter format runs fine.
pre-push with flutter analyze and flutter test didn't work - no output.

Tested on Mac OS X Catalina 10.15.4

@togiberlin, I ended up using just Lefthook itself and it's working fine.

Then I wrote a blog post about it - see here.

@arthurdenner Yeah, same here. I just ended up installing it via homebrew.