问题
After so many years cruising on Linux, I am back on a freaking Windows environment. I use Ipython, and I launch it in git bash. It would be hard for me to use something else, since the environment is configured to use this at my office.
So, when I launch Ipython, and I mistakenly launch an infinite loop, or some bad code that takes ages to execute, I use ctrl-c.
This kills Ipython, and it's pretty annoying. I did not find any way to circumvene this or another key that would do the trick.
Any ideas would be highly appreciated.
Thanks a bunch
回答1:
I actually found an elegant solution. I put this in my .bashrc:
alias p="trap '' 2; ipython;trap 2;"
that way, ctrl-c signal (which code is 2) gets trapped before launching it, and untrapped when exiting ipython.
来源:https://stackoverflow.com/questions/23678045/control-c-kills-ipython-in-git-bash-on-windows-7