Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(macos) tmux + brew gnu coreutils combination does not work with 'selecta' #103

Open
vimkim opened this issue Sep 21, 2018 · 3 comments
Open

Comments

@vimkim
Copy link

vimkim commented Sep 21, 2018

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,

  1. 'Selecta' works well inside tmux if I comment out the following line from my .zshrc:
    export PATH="/usr/local/opt/coreutils/libexec/gnubin:$PATH"
  2. 'Selecta' works well outside tmux no matter if I comment out the above line or not.
  3. '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
@vimkim vimkim changed the title Strange: tmux + brew gnu coreutils combination does not work with this app (macos) tmux + brew gnu coreutils combination does not work with this app Sep 21, 2018
@vimkim vimkim changed the title (macos) tmux + brew gnu coreutils combination does not work with this app (macos) tmux + brew gnu coreutils combination does not work with 'selecta' Sep 21, 2018
@garybernhardt
Copy link
Owner

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.

@rschmitt
Copy link
Contributor

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

@Julian
Copy link

Julian commented Oct 19, 2018

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants