
cygwin ターミナル ウィンドウを閉じると、次のようなメッセージが表示されます。
Processes are running in session.
<list of processes>
Close anyway?
---------------------------
OK Cancel
---------------------------
そして、毎回 OK ボタンを押すのが嫌です。この迷惑な警告を消すにはどうすればいいでしょうか? この問題を Google で調べるのに苦労しました…
私は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
たhttps://mintty.github.io/mintty.1.html#設定
答え2
少し混乱しているようですが、cygwin は共有ライブラリです。
そのライブラリを使用するプログラムを実行しています。
状況を説明してみます:
ターミナル (mintty) を起動すると、当然ながらコマンド シェル (bash) が呼び出されます。コマンド シェルから追加のプログラムを実行すると、プロセス ツリーは次のようになります。
$ pstree
?───mintty───bash───pstree
これは最小限のツリーのケースです。
シェルから追加のプログラムを実行し、その終了を待ったり要求したりしない場合は、mintty に終了を要求すると、実行中のプロセスがあること、および親プロセス (mintty) を閉じるとすべての子プロセスが強制的に閉じられることが強調表示されます。唯一の子プロセスがコマンド シェルであり、それが非アクティブである場合、mintty は確認を要求せず、自身とシェルを終了します。
したがって、mintty が停止してすべての子プロセスを終了するかどうかの確認を求めるには、実行中のすべてのプロセスを終了する必要があります。