pschmitt / tmux-ssh-split

TMUX plugin to split the current pane while retaining SSH connections
GNU General Public License v3.0
74 stars 6 forks source link

MacOS Compatibility #2

Closed vvbandeira closed 4 years ago

vvbandeira commented 4 years ago

Hi, I had an issue when using the plugging in MacOS.

The root cause is the line below. The keyword cmd= is not recognized by the BSD version of ps. For details see the FreeBSD manpage.

https://github.com/pschmitt/tmux-ssh-split/blob/0465ed17f65d3e2350a30e282f980e5d4e264d18/scripts/tmux-ssh-split.sh#L43

A possible fix is to add command= to the keyword list as follows: child_cmd="$(ps -o cmd=,command= "$child_pid")"

Thanks for the plugin!

pschmitt commented 4 years ago

Sure. Can you open a PR?

pschmitt commented 4 years ago

BTW shouldn't it be ps -o command= "$child_pid"?

Using both cmd and command will output the full command twice on Linux.

vvbandeira commented 4 years ago

I am not 100% on which is the most compatible across implementations of ps. Right now I only have access to a macOS machine, but from your comment using just command= should work for macOS and GNU/Linux.

If you think is best, maybe you can add a if check for MacOS:

if [[ "$(uname)" == "Darwin" ]]
        # use command=
else
        # use cmd=
fi

I leave that to your discretion as both would solve the issue. If you create a commit with the option you are more comfortable with that would be best. Thanks.

pschmitt commented 4 years ago

Why don't you open a PR? :)