-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Describe the bug
After interrupting a command with Ctrl+C , subsequent bash alias commands sometimes output errors like bash: break: only meaningful in a for', while', or until' loop" and "bash: 2: unbound variable`. The error seems to be inconsistent as it sometimes disappears without clear cause
To Reproduce
Steps to reproduce the behavior:
- Let's assume I have pre-commit hooks set up in a git repository
- Then run
git commitwhich triggers pre-commit hooks - Interrupt the process with Ctrl+C during hook execution
- Run an aliased command (such as
LL) - Throws the error
bash: break: only meaningful in a for', while', oruntil' loop`
Expected behavior
After interrupting a command with Ctrl+C, subsequent commands should run normally without any leftover error messages about break statements or unbound variables.
Screenshots
NA
Desktop (please complete the following information):
- OS: Ubuntu 20.04 LTS on Windows 10 x86_64
- Desktop environment: NA
- Shell: Bash 5.0.16
- Repository version: latest (tbd)
Additional context
Seems to be related to the state of the shell after interrupting commands. The error specifically mentions that break commands are being executed outside of loops, I think this suggests that an interrupted script might be leaving the shell in an inconsistent state. some environment variables or shell state isn't being properly cleaned up