Skip to content

Option to abort a script if a command fails (e.g., set -o errexit) #510

@darthdeus

Description

@darthdeus

Think of this as an alternative to set -e in bash. What it would do is abort the whole script, if a single line fails.

This is useful in cases like this

import foo
do_some_magic
import bar

in this case you definitely don't want to do_some_magic if import foo fails.

It might also be good to have this option available just for blocks, so that you could do

some_magic

begin -e # or whatever the switch will be
  first_thing  # if this fails, the whole block will exit
  second_thing
end

some_more_magic

Using and is not a solution for more than two commands, as it pollutes the script, makes it harder to refactor, etc.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions