franciscolourenco / done

A fish-shell package to automatically receive notifications when long processes finish.
MIT License
766 stars 70 forks source link

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

Closed rstacruz closed 5 months ago

rstacruz commented 2 years ago

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:

Thank you for all your hard work with done!

rstacruz commented 2 years ago

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
ovikk13 commented 2 years ago

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

blissdev commented 2 years ago

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).

franciscolourenco commented 5 months ago

Fixed by #124. Please reopen if needed.