windows 暂停在控制台 2 内运行的 bash 中的进程

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/7899797/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 18:21:36  来源:igfitidea点击:

Suspending a process in bash running inside console2

windowsbashbackground-processconsole2

提问by artm

In other terminals I would press Ctrl+zto suspend an application, often to then issue bgto send it into background.

在其他终端中,我会按下Ctrl+z暂停应用程序,通常然后发出bg将其发送到后台。

In console2 Ctrl+zdoes nothing, probably because the key combination has a different meaning in Windows. But is there a way to achieve the same effect, save for 'process &'?

在 console2Ctrl+z中什么也不做,可能是因为组合键在 Windows 中具有不同的含义。但是有没有办法达到同样的效果,除了'process &'?

(I know I should use &and it works, but sometimes I would setup shell, start an editor, begin editing, then return to the console just to find that I forgot the &and I can't use the shell. It annoys me that I then have to either open a new shell and set it up again, or quit the editor, start it with &and set it up again).

(我知道我应该使用&它并且它可以工作,但有时我会设置 shell,启动一个编辑器,开始编辑,然后返回到控制台只是发现我忘记了&并且我无法使用 shell。这让我很恼火然后必须打开一个新的 shell 并重新设置它,或者退出编辑器,启动它&并重新设置它)。

采纳答案by Thiago Curvelo

This annoying issue surely is a console2 bug. You may find something about at its issue tracker.

这个烦人的问题肯定是 console2 的错误。您可能会在其问题跟踪器中找到相关信息。

Anyway, what ctrl+zdoes is send a SIGSTOPsignal to current process. So, you can still send that signal from another session/tab. (If it is less annoying than stop and start with &). To do that, you can use the killcommand.

无论如何,要做的ctrl+z是向SIGSTOP当前进程发送信号。因此,您仍然可以从另一个会话/选项卡发送该信号。(如果它比停止并开始更不烦人的话&)。为此,您可以使用该kill命令。

kill -s SIGSTOP pid

(pid is the process PID number)

(pid为进程PID号)

Hope it helps.

希望能帮助到你。

回答by Gilles Philippart

In Console2, ctrl-c is bound by default to copy (text) you have to press ctrl-shift-c to cancel job.

在 Console2 中,ctrl-c 默认绑定到复制(文本),您必须按 ctrl-shift-c 才能取消作业。

回答by Nicholas Pufal

You could also try to remove the hotkey that is conflicting with ctrl+z.

您也可以尝试删除与ctrl+z.

I was having trouble using ctrl+cto cancel the execution of a script. As soon as I removed that hotkey, ctrl+chad its default restored and I was able to cancel executions properly.

我无法ctrl+c取消脚本的执行。一旦我删除了那个热键,ctrl+c它的默认值就恢复了,我就可以正确取消执行了。