Control-C kills Ipython in git bash on Windows 7

北城余情 提交于 2019-12-10 20:17:50

问题


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

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!