-
-
Notifications
You must be signed in to change notification settings - Fork 8
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
Allow specifying the expected return code instead of erroring on non-zero results #10
Comments
Agreed. I didn't know Sphinx had such a plugin 🙂 |
WDYT about an ```bash exec="true" expect="1"
program-that-exits-with-1
``` Also, should we accept other values for Python code blocks? Something like |
For the sake of consistency with other tools, please use
I think that even an exception would translate to an exit code, so no need to extra complicate it.
Basically python will return exit code "1" when an exception is raised and I would recommend using the same approach for python blocks. Think about other code blocks, they should all run as subprocess for safety reasons anyway, so "returncode" is the portable solution. I will also want to add an option to hide stderr like I had with sphinx, for now I had to add |
Thanks for the feedback! I'll go with About execution of Python code blocks: they're currently executed in the main process, with an isolated |
Implemented (see commit above) 🙂 |
While documenting different executions, we might really need to execute commands that do not return 0 exit code. Current version of the plugin does raise a warning, which is converted to an error when running in strict mode.
Looking at how others did this, we can take a look at https://pythonhosted.org/sphinxcontrib-programoutput/#error-handling which allows users to mention expected return code.
The text was updated successfully, but these errors were encountered: