Script (e.g. Bash) magics doesn't have an error on status code
See original GitHub issueI ran into a use-case where I wanted to call a small bash script magic in a notebook, but couldn’t halt execution easily based on exit status.
======= Cell 1 =======
%%bash
not_a_valid_command
======= Cell 2 =======
print("I don't want to run this if the bash command didn't return status code 0")
It seems like the script magics and the code don’t have any options to inform the subprocess to error on non-zero status code. This would be nice to be configurable and/or defaulted.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Bash command line exit codes demystified
When you execute a command or run a script, you receive an exit code. An exit code is a system response that reports...
Read more >Raise error in a Bash script - linux
When you need to indicate to the OS that the program stopped abnormally (eg. an error occurred), you need to pass a non-zero...
Read more >Using “reserved” codes for exit status of shell scripts
In my opinion the author of the page you linked is making an unsupported assertion that the listed exit codes are reserved based,...
Read more >Built-in magic commands — IPython 8.7.0 documentation
In [4]: foo() foo() has now been changed! Here is an example of how to edit a code snippet successive times. First we...
Read more >Advanced Bash-Scripting Guide
Insert code here to print error message and exit if not root. ... or in this case an executable shell script (type man...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
See #11287
Ok let me see if I can make a PR to change the default behavior to make use of this for the 7.0 milestone.