Control-C在Windows 7的git bash中杀死Ipython [英] Control-C kills Ipython in git bash on Windows 7

查看:152
本文介绍了Control-C在Windows 7的git bash中杀死Ipython的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Linux上经历了这么多年的巡航之后,我重新回到了一个惊人的Windows环境。
我使用Ipython,并在git bash中启动它。
因为环境被配置为在我的办公室使用它,所以我很难使用别的东西。

所以,当我启动Ipython时,我错误地启动了一个无限循环,或者一些需要时间去执行的错误代码,我使用ctrl-c。



这会导致Ipython死机,而且非常烦人。我没有找到任何方法来绕过这个或另一个关键,可以做到这一点。



任何想法将不胜感激。



非常感谢

解决方案

我实际上找到了一个优雅的解决方案。我把它放在我的.bashrc中:

 别名p =trap'2; ipython; trap 2; 

这样,ctrl-c信号(代码是2)在启动之前被捕获,当退出ipython时。


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

解决方案

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.

这篇关于Control-C在Windows 7的git bash中杀死Ipython的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆