
當我關閉 cygwin 終端機視窗時,會顯示以下訊息:
Processes are running in session.
<list of processes>
Close anyway?
---------------------------
OK Cancel
---------------------------
我討厭每次都按“確定”按鈕。如何抑制這個煩人的警告?我厭倦了谷歌這個問題......
我正在Win7-10環境下工作。
答案1
這樣就可以了。
mintty.exe -o ConfirmExit=no
這對於快捷方式*.lnk
文件非常有用。例如,這是我創建的用於觀看日誌的連結tail -f
:
C:\tools\cygwin\bin\mintty.exe -o ConfirmExit=no -s 54,78 -e /usr/bin/bash -l -c 'tail -n 200 -f /cygdrive/c/logs/NSSM.log'
這-s 54,78
使得視窗具有顯示的完整高度以及日誌條目的寬度。需要-l -c
使 bash 能夠在其中找到可執行文件$PATH
看:
$ mintty.exe --help
Usage: mintty [OPTION]... [ PROGRAM [ARG]... | - ]
Start a new terminal session running the specified program or the user's shell.
If a dash is given instead of a program, invoke the shell as a login shell.
Options:
-c, --config FILE Load specified config file (cf. -C or -o ThemeFile)
-e, --exec ... Treat remaining arguments as the command to execute
-h, --hold never|start|error|always Keep window open after command finishes
-p, --position X,Y Open window at specified coordinates
-p, --position center|left|right|top|bottom Open window at special position
-p, --position @N Open window on monitor N
-s, --size COLS,ROWS Set screen size in characters (also COLSxROWS)
-s, --size maxwidth|maxheight Set max screen size in given dimension
-t, --title TITLE Set window title (default: the invoked command) (cf. -T)
-w, --window normal|min|max|full|hide Set initial window state
-i, --icon FILE[,IX] Load window icon from file, optionally with index
-l, --log FILE|- Log output to file or stdout
--nobidi|--nortl Disable bidi (right-to-left support)
-o, --option OPT=VAL Set/Override config file option with given value
-B, --Border frame|void Use thin/no window border
-R, --Reportpos s|o Report window position (short/long) after exit
--nopin Make this instance not pinnable to taskbar
-D, --daemon Start new instance with Windows shortcut key
-H, --help Display help and exit
-V, --version Print version information and exit
See manual page for further command line options and configuration.
-o
我找到了at 的選項https://mintty.github.io/mintty.1.html#配置
答案2
看來你有點困惑:cygwin 是一個共享函式庫。
您正在執行使用該庫的程式。
我將嘗試解釋一下情況:
您啟動了一個終端機 (mintty),它當然會呼叫命令 shell (bash)。如果您從命令 shell 運行其他程序,進程樹將如下所示:
$ pstree
?───mintty───bash───pstree
這是一個最小的樹案例。
如果您從 shell 運行其他程式並且不等待或請求它們結束,那麼當您要求 mintty 終止自身時,它會突出顯示您正在運行進程,並且關閉父進程 (mintty) 將強制關閉所有進程這些孩子。如果唯一的子級是命令 shell,且它處於非活動狀態,mintty 將不需要確認並將終止自身和 shell。
因此,您需要終止所有正在運行的進程,以便 mintty 停止詢問您是否確認殺死所有子進程。