简体   繁体   English

处理Emacs shell和Cygwin下的信号

[英]Handling signals under Emacs shell and Cygwin

I use the Cygwin version of Emacs. 我使用Cygwin版本的Emacs。 Things are just fine except for some quirks when using the Emacs shell (Mx shell). 除了使用Emacs shell(Mx shell)时的一些怪癖之外,情况还算不错。 The Emacs shell is using Cygwin's bash. Emacs shell正在使用Cygwin的bash。 The biggest problem right now is not being able to send a SIGINT to the shell to interrupt the currently running command. 目前最大的问题是无法向shell发送SIGINT来中断当前运行的命令。 For example, I frequently use ssh to logon to a remote host, then "tail -f" a file. 例如,我经常使用ssh登录到远程主机,然后“tail -f”文件。 I can't break out of the tail command. 我无法突破尾巴命令。 When using the Emacs shell under Unix/Linux, pressing Cc Cc (comint-interrupt-subjob) will send SIGINT to the shell (bash), and the tail command (or whatever) will be interrupted as expected. 在Unix / Linux下使用Emacs shell时,按Cc Cc(comint-interrupt-subjob)会将SIGINT发送到shell(bash),tail命令(或其他)将按预期中断。

For a quick and easy example, run "Mx shell", then "sleep 30", and try to interrupt the sleep command. 有关快速简单的示例,请运行“Mx shell”,然后“sleep 30”,并尝试中断sleep命令。 You can Quit (Cg) and do other things within Emacs, but the Emacs shell is hung for the duration of the sleep command. 您可以退出(Cg)并在Emacs中执行其他操作,但Emacs shell会在sleep命令的持续时间内挂起。

I have a feeling this has something to do with the difference in signal sending/handling within Cygwin, as opposed to signals within Unix. 我觉得这与Cygwin中信号发送/处理的差异有关,而不是Unix中的信号。 Since the Cygwin bash shell responds appropriately to signals, I have to assume there is some way to get Emacs to send a SIGINT to the bash shell in a way that it understands. 由于Cygwin bash shell对信号作出了适当的响应,我不得不假设有一些方法可以让Emacs以一种它理解的方式将一个SIGINT发送到bash shell。 Any ideas? 有任何想法吗?

By the way, I have used Emacs eshell, term and ansi-term, but I prefer shell for a number of reasons. 顺便说一下,我使用了Emacs eshell,term和ansi-term,但出于多种原因我更喜欢shell。 I also use mintty and GNU Screen, and have no complaints there, but using Emacs shell and treating my terminal sessions like text files is a wonderful thing. 我也使用mintty和GNU Screen,并且没有任何抱怨,但使用Emacs shell并将文本文件视为终端会话是一件很棒的事情。

I think this is more of a problem with the Command Prompt as a tty. 我认为这更像是命令提示符作为tty的问题。 I had problems sending the correct signals to the emacs shell inside Cygwin and Cygwin in general, so I found this program called puttycyg. 我在向Cygwin和Cygwin中的emacs shell发送正确的信号时遇到了问题,所以我发现这个程序名为puttycyg。 Putty has a great shell and I wanted something like that for Cygwin, so I use this: http://code.google.com/p/puttycyg/ . Putty有一个很好的shell,我想要Cygwin这样的东西,所以我使用它: http//code.google.com/p/puttycyg/

I created a shortcut on my desktop to make it easier to get to. 我在桌面上创建了一个快捷方式,以便于访问。 You can create a session and call it "cygwin" from there and then make a shortcut to the executable and use -load "cygwin" . 您可以创建一个会话并从那里将其命名为“cygwin”,然后创建可执行文件的快捷方式并使用-load "cygwin"

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM