[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Help-bash] Looking for something like "errexit" for interactive ses
From: |
Eric Pruitt |
Subject: |
Re: [Help-bash] Looking for something like "errexit" for interactive sessions |
Date: |
Sat, 31 Aug 2019 22:53:50 -0700 |
User-agent: |
NeoMutt/20170113 (1.7.2) |
On Tue, Aug 27, 2019 at 02:42:16PM -0700, Eric Pruitt wrote:
> Is there a feature akin to errexit that's interactive session friendly
> i.e. instead of causing the session to exit, it'd drop the user back to
> a prompt if a command finished with a non-zero status?
On Wed, Aug 28, 2019 at 06:29:52PM -0700, Eric Pruitt wrote:
> The middle ground is going to the prompt in situations where the shell
> would exit with errexit. If the option existed and was called
> "err>prompt<" instead "err>exit<", I'd want it to work like this:
>
> # Normal session
> ~$ true; echo x; (exit 123); echo y
> x
> y
>
> # With non-existent option I'm calling errprompt
> ~$ set -o errprompt
> ~$ true; echo x; (exit 123); echo y
> x
> ~$ echo $?
> 127
>
> Essentially it's analogous to errexit but, instead of exiting, it
> dumps you back at a prompt as described in my original message
I've got a preliminary patch that makes errexit behave this way in an
interactive shell. I haven't been using it long (I did this literally
minutes ago), and I need to study the Bash source some more to better
how reader_loop is works, so there are probably bugs and/or unintended
consequences.
Eric
interactive-errexit.patch
Description: Text Data
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [Help-bash] Looking for something like "errexit" for interactive sessions,
Eric Pruitt <=