-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Click command always return exit code zero #747
Comments
Use |
@untitaker Okay let me try so I would replace this line
to this line right
|
Yes, exactly. |
Thank you @untitaker it works! |
Is there a reason click was designed to return NOT return the value of the function? I assumed that the command-line version of my click-decorated functions would send their return value back to the shell, and I was surprised that the return value is always "0". It seems like a simple modification:
This change appears to cause errors in the pytests in test_chain.py (on the |
The rv already means something (i.e. it can be propagated), there was a PR referencing this issue that explored this.
…On 28 June 2017 18:39:35 GMT+02:00, Peter Hutkins ***@***.***> wrote:
Is there a reason click was designed to return NOT return the value of
the function? I assumed that the command-line version of my
click-decorated functions would send their return value back to the
shell, and I was surprised that the return value is always "0".
It seems like a simple modification:
```
diff --git a/click/core.py b/click/core.py
index b307407..4c5b93e 100644
--- a/click/core.py
+++ b/click/core.py
@@ -709 +709 @@ class BaseCommand(object):
- ctx.exit()
+ ctx.exit(rv)
```
This change appears to cause errors in the pytests that test chaining
(on the ```assert not result.exception``` line), but I don't know the
click project well enough to know if that is a real problem or just the
assumptions of the tests.
--
You are receiving this because you were mentioned.
Reply to this email directly or view it on GitHub:
#747 (comment)
--
Sent from my Android device with K-9 Mail. Please excuse my brevity.
|
Is this the PR you're referring to? |
It turned out that some tests failed in 'manage.py test', but the command returned exit status 0. So we were not informed about our CI failures. This seems to be known and desired design of click, unfortunately: pallets/click#747
Click does not let the return code pass through. So, we explicitly use sys.exit(). pallets/click#747
My click command is using
subprocess
moduleeven though my test fail click always return exit code zero.
but when I run the the same command with separate file
the exit code is 1. I'm using the click commad in CI even my test fail the CI build always passed because my click command always return exit code zero
The text was updated successfully, but these errors were encountered: