Skip to content
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

EXIT trap doesn't trigger when exiting from other signals #699

Open
Crestwave opened this issue Apr 7, 2020 · 1 comment
Open

EXIT trap doesn't trigger when exiting from other signals #699

Crestwave opened this issue Apr 7, 2020 · 1 comment

Comments

@Crestwave
Copy link
Contributor

Crestwave commented Apr 7, 2020

Used in #679. The great thing about Bash's trap is that you can trap EXIT and it will trigger on all other kinds of signals that make the program exit. It's a bit (very if you want to make it compatible with various POSIX shells) complicated to handle cleanup functions correctly without this, as simply trapping INT will prevent it from exiting on INT.

$ cat <<'EOF' >a
> trap 'echo foo' EXIT
> sleep 999
> EOF
$ bash a
^Cfoo

$ osh a
^C
$ 
@andychu
Copy link
Contributor

andychu commented Apr 26, 2020

Related: #619 for DEBUG trap

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants