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
conda run is not preserving exit code #9599
Comments
Our team have many things to work on. PRs that try to fix this would be welcome if you are interested. Conda run is still not ready for prime time usage unfortunately. |
We are not churning out new conda features. |
It appears commit c7d5ada introduced the error. Returning a namedtuple (Response) instead of an int breaks this logic Lines 84 to 86 in e9a5056
I can create a pull request to fix. Thoughts on reverting the return value to an int vs expanding the logic at the call site in main.py? I can't find rationale for changing the return value. |
The scarier point as I see it is that If I recall correctly, I now use a simple PATH based activation approach instead in my Dockerfile. |
FWIW, here is a high-level unit test to test the functionality after a fix is implemented: import subprocess
import unittest
class TestExitCodes(unittest.TestCase):
# Note: conda=4.8.1 (but not conda=4.8.0) always incorrectly returns exit code 0.
def test_exit_codes(self):
for expected_exit_code in range(3):
with self.subTest(exit_code=expected_exit_code):
actual_exit_code, _output = subprocess.getstatusoutput(f"conda run exit {expected_exit_code}")
self.assertEqual(expected_exit_code, actual_exit_code)
if __name__ == "__main__":
unittest.main() If using this test with a failing conda, e.g. 4.8.1 or 4.8.2, consider adding the decorator |
I'd like to see a fix for this also. |
As of conda 0.48.1 `conda run -n` doesn't exit with the code that the command it ran exited with. This causes all the Numba integration tests to silently be successful. A PR is in flight to fix this already, but we hotfix it for now to get the tests up and running again. Issue: conda/conda#9599 PR: conda/conda#9665
I believe this is a duplicate of #8385 perhaps? |
@impredicative I have removed you latest comment from this issue. It is not constructive and the tone is not welcome here. If you continue to make comments along these lines your account will be banned. |
set errorlevel when 'conda run' exits (Resolves #9599)
Finally this is fixed and released in v4.8.4. Thank you @chenghlee !
|
Hi there, thank you for your contribution to Conda! This issue has been automatically locked since it has not had recent activity after it was closed. Please open a new issue if needed. |
Current Behavior
conda run
used to return the correct exit status of the target process, but it doesn't anymore. This was apparently working correctly in conda 4.8.0 but it seems broken since version 4.8.1.conda run
now erroneously always return the exit status of 0. This is a serious problem as jobs fail silently now.Steps to Reproduce
Expected Behavior
conda run
should preserve the exit status of the target process, whether the target ispython
or otherwise. It worked correctly with the previous version:Environment Information
This issue really is independent of the environment as it happens both in various dockerfiles and on MacOS too.
@msarahan Please fix this bug considering I see a commit from 25 days that may have introduced it! Adding unit tests would also be wise.
The text was updated successfully, but these errors were encountered: