question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Script (e.g. Bash) magics doesn't have an error on status code

See original GitHub issue

I 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:closed
  • Created 5 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
Carreaucommented, Sep 6, 2018

See #11287

0reactions
MSealcommented, Aug 27, 2018

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found