linux - How Ctrl-C propagates through tmux -
i know when hit ctrl-c, operating system pts system interprets , sends sigint
foreground process group. wonder how propagates through tmux
.
say running normal linux x server , window manager. opened xterm
, in zsh
running tmux
. in tmux
running bash
, in ./a.out
.
process tree window manager
-> xterm
-> zsh
-> tmux client
. tmux server
-> bash
-> ./a.out
.
so when hit ctrl-c on keyboard, x server first catches , tells active window xterm
"hey guy hit ctrl-c". xterm
tells process it's directly running (zsh
) hit ctrl-c sending pseudo terminal pts/0
"ctrl-c" character. operating system saw "ctrl-c" character in pseudo terminal , translates sigint
foreground process group (which zsh
, tmux client
). tmux client
must have received sigint
tells tmux server
, tmux server
sends sigint
foreground process group of pseudo terminal created (with bash
, ./a.out
in it). sorry if looks confusing. because of how tmux
works, tmux server
, tmux client
2 separate processes.
now if want mimic behavior, send sigint
tmux client
, expect ./a.out
receive sigint
if pressed "ctrl-c" on keyboard. nothing happens. guess wrong somewhere , can me it?
Comments
Post a Comment