done icon indicating copy to clipboard operation
done copied to clipboard

"basename: illegal option -- f" error when using with Tmux

Open rstacruz opened this issue 3 years ago • 3 comments

I'm running into an odd error where this error appears when using fish with Tmux. It's almost always reproduceable when ran with neovim, but can often appear when just using tmux.

~ > sleep 4
basename: illegal option -- f
usage: basename string [suffix]
       basename [-a] [-s suffix] string [...]

How to reproduce:

tmux # open tmux
nvim -u NONE '+:terminal' # open neovim with a terminal
sleep 4

Environment info:

  • os: MacOS 11.6
  • shell: fish 3.3.1
  • tmux 3.2a
  • Neovim 0.5.1
  • terminal: Hyper

Thank you for all your hard work with done!

rstacruz avatar Nov 29 '21 04:11 rstacruz

From what I can tell, this happens here:

    while set tmux_fish_ppid (ps -o ppid= -p $tmux_fish_pid | string trim)
        and ! string match -q "tmux*" (basename (ps -o command= -p $tmux_fish_ppid)) #<==
        set tmux_fish_pid $tmux_fish_ppid
    end

because tmux_fish_ppid is not available, the ps command gets this error

ps: option requires an argument -- p

Changing it to a hardcoded fish makes things work:

    while set tmux_fish_ppid (ps -o ppid= -p $tmux_fish_pid | string trim)
-       and ! string match -q "tmux*" (basename (ps -o command= -p $tmux_fish_ppid))
+       and ! string match -q "tmux*" fish
        set tmux_fish_pid $tmux_fish_ppid
    end

rstacruz avatar Nov 29 '21 04:11 rstacruz

This is solved by this pull request: https://github.com/franciscolourenco/done/pull/124

ovikk13 avatar Dec 18 '21 14:12 ovikk13

I'm also seeing this issue. Not sure why, but it just started appearing for me. (Ah from #124 I see that it's because I am now setting a start directory in Tmux).

blissdev avatar Jan 05 '22 19:01 blissdev

Fixed by #124. Please reopen if needed.

franciscolourenco avatar Jan 10 '24 13:01 franciscolourenco