artemave/tmux_super_fingers

sorting tty output broke tmux_super_fingers on macOS

HartBlanc opened this issue · 1 comments

Commit 3228745 broke the plugin on macOS as ps on macOS does not accept the --sort flag.

I forked and removed the --sort flag which fixed it for me.

traceback when attempting to open file:

ps: illegal option -- -
usage: ps [-AaCcEefhjlMmrSTvwXx] [-O fmt | -o fmt] [-G gid[,gid...]]
          [-g grp[,grp...]] [-u [uid,uid...]]
          [-p pid[,pid...]] [-t tty[,tty...]] [-U user[,user...]]
       ps [-L]
Traceback (most recent call last):
  File "/Users/{user}/.tmux/plugins/tmux_super_fingers/run.py", line 27, in <module>
    wrapper(main)
  File "/Users/{user}/.pyenv/versions/3.10.0/lib/python3.10/curses/__init__.py", line 94, in wrapper
    return func(stdscr, *args, **kwds)
  File "/Users/{user}/.tmux/plugins/tmux_super_fingers/run.py", line 22, in main
    renderer.loop()
  File "/Users/{user}/.tmux/plugins/tmux_super_fingers/tmux_super_fingers/panes_renderer.py", line 36, in loop
    chosen_mark.perform_primary_action()
  File "/Users/{user}/.tmux/plugins/tmux_super_fingers/tmux_super_fingers/mark.py", line 22, in perform_primary_action
    self.target.perform_primary_action()
  File "/Users/{user}/.tmux/plugins/tmux_super_fingers/tmux_super_fingers/targets/target.py", line 33, in perform_primary_action
    action_class(self.payload).perform()
  File "/Users/{user}/.tmux/plugins/tmux_super_fingers/tmux_super_fingers/actions/send_to_vim_in_tmux_pane_action.py", line 17, in perform
    editor_pane = self.cli_adapter.find_tmux_pane_with_running_process(os.environ['EDITOR'])
  File "/Users/{user}/.tmux/plugins/tmux_super_fingers/tmux_super_fingers/cli_adapter.py", line 62, in find_tmux_pane_with_running_process
    tty_infos = shell(f"ps --sort=tty -o state= -o comm= -o tty= -t {','.join(tty_list)}").split('\n')
  File "/Users/{user}/.tmux/plugins/tmux_super_fingers/tmux_super_fingers/utils.py", line 23, in shell
    return subprocess.run(
  File "/Users/{user}/.pyenv/versions/3.10.0/lib/python3.10/subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['ps', '--sort=tty', '-o', 'state=', '-o', 'comm=', '-o', 'tty=', '-t', '/dev/ttys001,/dev/ttys002,/dev/ttys003']' returned non-zero exit status 1.

Right. Sorry for that! Will revert.