selecta
selecta copied to clipboard
(macos) tmux + brew gnu coreutils combination does not work with 'selecta'
Thx for this awesome plugin.
I found a really mysterious bug. It works well with either tmux or gnu coreutils but not with both. Specifically,
- 'Selecta' works well inside tmux if I comment out the following line from my .zshrc:
export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
- 'Selecta' works well outside tmux no matter if I comment out the above line or not.
- 'Selecta' does not work if I use both tmux and gnu tools. The error message is the following:
Traceback (most recent call last):
9: from /usr/local/bin/selecta:839:in `<main>'
8: from /usr/local/bin/selecta:45:in `main'
7: from /usr/local/bin/selecta:584:in `with_screen'
6: from /usr/local/bin/selecta:801:in `with_tty'
5: from /usr/local/bin/selecta:591:in `block in with_screen'
4: from /usr/local/bin/selecta:613:in `restore_tty'
3: from /usr/local/bin/selecta:821:in `stty'
2: from /usr/local/bin/selecta:828:in `command'
1: from /usr/local/bin/selecta:828:in `pipe'
/usr/local/bin/selecta:831:in `block in command': Command failed: "stty 6902:3:4b00:5cb:4:ff:ff:7f:17:15:12:0:3:1c:1a:19:11:13:16:f:1:0:14:0" (RuntimeError)
so yeah, I think it might be because of the incompatibilities between /bin/stty and gnu stty or else.
My environment:
- macOS High Sierra 10.13.4
- tmux 2.7
- brew coreutils 8.30
- zsh 5.6.2
Yes, it looks like a stty incompatibility. I'm very confused about why this would fail. All Selecta does is stty -g
, then it takes the output of that and feeds it back to stty
to restore the terminal state. And the documentation for stty -g
says that this is exactly what it's for: "print all current settings in a stty-readable form".
In general, I'd recommend against running GNU coreutils on OS X. I've tried it in the past it leads to a lot of this stuff, because at that point your userland is part BSD, part Mac, and part GNU, which confuses a lot of tools (apparently including Selecta).
Curses would surely make this go away, but it's not in the stdlib any more, so it's not an option. If you can find a way to make this work, I'm happy to review and merge it, but I don't want to go on a broken-stty hunt myself.
@dqgthb Just for grins, can you try hardcoding /usr/local/opt/coreutils/libexec/gnubin/stty
into Selecta? Like Gary pointed out, there's no reason why either stty
executable should be incompatible with its own stty -g
output. For what it's worth, I tried replacing stty
with gstty
on my own Mac, and it seems to have worked fine.
@rschmitt what I thought was a separate issue I filed as #105, given that it was reproducible even outside of tmux, and selecta works unless I type immediately before output has appeared, but I can confirm that what you suggested (replacing stty
on this line with /bin/stty
) fixes mine.