4.1 C
New York
Friday, November 22, 2024

command line – Operating `ps -t /dev/` began inflicting the desired terminal to cease receiving most keystrokes


Particular Drawback

Operating ps -t /dev/ just lately began inflicting the related terminal to cease receiving some keystrokes. I can not fathom why this began occurring now, with none software program updates that I am conscious of.

After working the ps command, most keystrokes will now not make it by means of to this shell or no matter program is working within the tty (e.g. in the event you run it from in a vim subshell). Solely a subset make it by means of, requiring repeating keypresses a number of instances earlier than they register, as if eaten by one other course of. Repeated runs of ps -t exacerbate the issue additional.

To Reproduce

Notably, I can solely reproduce this on considered one of my machines.

ps -t $(tty)

A major share of keystrokes are dropped from the TTY now.

It may be run on the present TTY or one other TTY. The goal TTY is affected.

To recuperate from this, exit the TTY utilizing Ctrl+D or exit. (Keystrokes will have to be entered repeatedly.)

I would have an interest to listen to who can and can’t reproduce this.

Why That is Wanted

vim-tmux-navigator makes use of this tmux configuration to detect whether or not vim is the energetic course of within the present tmux pane, in an effort to enable seamless navigation inside and between vim splits and tmux panes.

is_vim="ps -o state= -o comm= -t '#{pane_tty}' | 
        grep -iqE '^[^TXZ ]+ +(S+/)?g?(view|l?n?vim?x?|fzf)(diff)?$'"
bind-key -n M-h if-shell "$is_vim" "send-keys M-h"  "select-pane -L"
bind-key -n M-j if-shell "$is_vim" "send-keys M-j"  "select-pane -D"
bind-key -n M-k if-shell "$is_vim" "send-keys M-k"  "select-pane -U"
bind-key -n M-l if-shell "$is_vim" "send-keys M-l"  "select-pane -R"

Variations

I am working MacOS 14.6.1.

The /bin/ps executable hasn’t been touched in a number of months, and this has been working since.

❯ ls -l `which ps`
-rwsr-xr-x  1 root  wheel  170816 Aug  4 06:31 /bin/ps

I have never up to date the rest that I do know of since this was final working.

Additional weirdness

After a tty begins shedding keystrokes, whether it is killed through tmux :kill-window somewhat than exiting usually, then different issues begin hanging till reboot:

  • brew (which is run to test openssl model throughout bashrc run) generally begins hanging and can’t be killed with ^C or stopped with ^Z till after rebooting, which blocks new terminals from beginning.
  • sudo dmesg hangs and can’t be killed with ^C or stopped with ^Z till after rebooting.
  • ps -ef outputs some processes however then hangs. Not like the others, it can be killed with ^C.

Related Articles

LEAVE A REPLY

Please enter your comment!
Please enter your name here

Latest Articles