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

trap is not executed when interrupting a sleep command #314

Open
sidec15 opened this issue Mar 18, 2024 · 0 comments
Open

trap is not executed when interrupting a sleep command #314

sidec15 opened this issue Mar 18, 2024 · 0 comments

Comments

@sidec15
Copy link

sidec15 commented Mar 18, 2024

In my .bashrc file I have the following

function cleanup() {
  echo "Global cleanup"
  for i in {1..2}; do
    echo $i
    sleep 1
  done
  
}

trap cleanup SIGINT

function infinite_loop() {
  local i=1
  while true; do
    echo "hello $i"
    i=$((i + 1))
    sleep 1
  done
}

I basically want to execute some cleanup code after typing Ctrl+c
If I type Ctrl+c in a msys shell the trap correctly works but if I run the infinite_loop function and then type Ctrl+c the cleanup code is not executed also if the infinite_loop is stopped.

I tried also to add the option:
MSYS=enable_pcon
in the .minttyrc file after reading this: mintty/mintty#56 (comment) without success.
The version is msys2-runtime 3.4.10-5

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

No branches or pull requests

1 participant