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

Exit only on error code? #91

Closed
duclet opened this issue Aug 17, 2016 · 5 comments
Closed

Exit only on error code? #91

duclet opened this issue Aug 17, 2016 · 5 comments

Comments

@duclet
Copy link

duclet commented Aug 17, 2016

So I have a post-commit hook which actually undo a commit if the history is not fully linear. Basically, it seems like any output that is made thru a commit hook, will end up on stderr. Since the code checks against that, it never gets to the tagging.

@stevemao
Copy link
Member

it seems like any output that is made thru a commit hook,

look like a bug in the commit hook

@Tapppi
Copy link
Member

Tapppi commented Aug 18, 2016

Indeed, what are you using to create the commit-hook?

@duclet
Copy link
Author

duclet commented Aug 19, 2016

The problem isn't the hook itself. It seems like to me, all output from programs executed by the git hook forcefully redirect standard out to standard err. I've verify this by running the program directly and it outputs to stdout. When running from the githook, it redirects to stderr.

Perhaps my question is also on why it was decided to terminate execution when there is a message on stderr even though the exit code signals it is okay? In terms out logging and outputting messages, many programs I see can emit warnings (which generally goes to stderr), not just errors. When there is an error, it should be terminating with an exit code greater than 0.

@e-cloud
Copy link
Contributor

e-cloud commented Sep 20, 2016

Source code here

One solution, when there is null err, and has stderr, the message may output as warnning and the program should not exit.

@nexdrew
Copy link
Member

nexdrew commented Sep 21, 2016

I agree with @duclet and @e-cloud - standard-version should not fail-fast simply from stderr output. I like the suggestion to "output a warning and continue". There's no reason to fail if git exits 0 (without an error).

stevemao pushed a commit that referenced this issue Sep 25, 2016
…#110)

* test: add test for not exiting on stderr content and match stderr output

* feat: don't fail fast on stderr content, and print stderr, closes #91

* fix: print warnings in yellow instead of red

* style: simplify handleExecError if logic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

5 participants