Permalink
Please sign in to comment.
Browse files
Bug fix: only run the EXIT trap at the top level of the root process.
It shouldn't fire when subshells/command sub/_HereDocWriterThunk thunk exit. Forking clones the stack, so the run_exit_trap boolean was not a sufficient guard! Related: the exit builtin has been reimplemented as static control flow (using our _ControlFlow exception), rather than a dynamic builtin calling sys.exit(). This makes it consistent with break/continue/return. I had to adjust a couple tests, but this usage seems reasonable. We'll see if it makes and wild tests fail. Examples: - 'exit 7 8 9' is now a syntax error rather than a runtime error - 'echo hi | exit 1' is also a syntax error. All spec tests and benchmarks now complete. The yash configure script was the one that tickled the bug of running the EXIT trap from multiple processes.
- Loading branch information...
Showing
with
48 additions
and 44 deletions.
- +3 −4 bin/oil.py
- +6 −18 core/builtin.py
- +29 −16 core/cmd_exec.py
- +1 −1 core/id_kind.py
- +1 −0 osh/lex.py
- +2 −2 spec/background.test.sh
- +6 −3 spec/builtins.test.sh
0 comments on commit
782a684