When use tig command with pipe | in zsh, command stop every time.
$ git log | tig
zsh: done git log |
zsh: suspended (tty output) tig
$ fg
[1] + done git log |
continued tig
zsh: can't set tty pgrp: operation not permitted
What's the problem?
You don't give much information on your configuration but some zsh versions had a regression on pgrp.
I have the similar issue, the command git diff head|tig returns:
[1] + 1026 done git diff head |
1027 suspended (tty output) tig
instead of showing what is expected.
I have all the newest: catalina, zsh, ohmyzsh, iterm2, brew, etc;
@jonas please help
The problem is linked with calls to setpgid / tcsetpgrp that were introduced by 71e8361.
The command fails with zsh 5.7.1 (x86_64-apple-darwin15.6.0) and zsh 5.6 (x86_64-apple-darwin15.6.0), however it worked well with zsh 5.0.8 (x86_64-apple-darwin15.0) and zsh 5.5.1 (x86_64-apple-darwin15.6.0) and it also works with other shells like ksh, bash.
So the cause is likely to be a regression in zsh introduced between zsh 5.5.1 and 5.6:
2018-04-17 Peter Stephenson <[email protected]>
* 42630: Src/exec.c, Src/signals.c: Improve process group
handling in pipelines. Main shell will reclaim terminal if
leader exits. Allow SIGCHLD to interrupt reading data from
command substitution.
I quick way to install zsh 5.5.1 for those using homebrew:
HOMEBREW_NO_AUTO_UPDATE=1 brew install https://raw.githubusercontent.com/Homebrew/homebrew-core/6d3232544b5f6f0d2b65c6ed89622beb11c4643b/Formula/zsh.rb
Catalina isn't in the formula at this point.
If you don't want to downgrade zsh, the workaround is to use parentheses: git log | (tig).
@koutcher @lwfitzgerald
Thank you for your reply and suggesting a solution!
@2energycell
I added alias to .zshrc like this.
alias tig=\(tig\)
git diff head | tig means git diff head | (tig) and work correctly.
The parenthesis trick isn't working for me, using zsh 5.8. Any other ideas to make it work?