tmux-cluster icon indicating copy to clipboard operation
tmux-cluster copied to clipboard

tmc <clustername> detaches current session then nothing happens (fish shell)

Open ElijahLynn opened this issue 7 years ago • 6 comments

Mostly posting this as a rubber duck debug method. I plan on posting solution at some point today.

I made a cluster in my ~/.clusterssh/clusters file and try launching with tmc <clustername and the current session detaches and then I get nothing. The same thing happens with + C. Also same with tmc -c "...".

I am inside Guake and also using fish shell and have tmux-cluster installed as a tmux plugin and am on master @ f2e19be.

ElijahLynn avatar Sep 04 '17 20:09 ElijahLynn

Guake ruled out, happens in normal terminal.

ElijahLynn avatar Sep 04 '17 20:09 ElijahLynn

Hrm, if I use tmc -w to keep it in the current session it goes to window 1 where I have 2 panes, and puts the controller in the right pane and then I control the left pane (which happened to be SSHd into a different server.)

Would be nice if there was a --verbose or --debug flag.

ElijahLynn avatar Sep 04 '17 20:09 ElijahLynn

I've never used fish shell before. Does this happen for you in bash as well?

tmux-cluster has a couple of debug-type options. You can print out a list of hosts in the cluster with -d, and you can print the tmux commands that would have been executed with -t.

davidscholberg avatar Sep 05 '17 14:09 davidscholberg

Finally tested this (had to logout to change default shell). It works if I change my default shell and logout/login. Script looks fairly simple so I will try to dig into it and see what is going on. I may just rewrite the script in fish.

ElijahLynn avatar Oct 17 '17 00:10 ElijahLynn

Oddly, if I launch bash from within fish (default shell /usr/bin/fish) then nothing happens.

ElijahLynn avatar Oct 17 '17 00:10 ElijahLynn

Finally put some time into figuring this out again.

Issue is 2 lines of code it appears:

243: `SHELL_CMD="ssh $HOST; [ \$? -eq 255 ] && (echo Press ENTER to close pane; read enter)"`
246: `SHELL_CMD="ssh $HOST; [ \$? -eq 255 ] && (echo Press ENTER to close pane; read enter)"`

I just needed to change both to

SHELL_CMD="ssh $HOST; [ \$status -eq 255 ]; and (echo Press ENTER to close pane; read enter)"

Because fish uses $status instead of $? for the return code of the last command. It also doesn't have && and instead uses ; and or ;and (same thing).

Maybe we can make a change that checks for the SHELL that tmc was invoked from and have a conditional SHELL_CMD, which would make the script fish compatible.

ElijahLynn avatar Mar 28 '18 01:03 ElijahLynn