Only modify terminal modes after config.fish if we have the terminal

This tried fiddling with the terminal even if fish didn't own it, e.g.
in

    fish -c 'sleep 5' &

Fixes #7808.
This commit is contained in:
Fabian Homborg 2021-03-10 09:38:16 +01:00
parent f204fd147d
commit 013a563ed0

View file

@ -1342,7 +1342,9 @@ void reader_init() {
// Set up our fixed terminal modes once,
// so we don't get flow control just because we inherited it.
term_donate(/* quiet */ true);
if (getpgrp() == tcgetpgrp(STDIN_FILENO)) {
term_donate(/* quiet */ true);
}
// We do this not because we actually need the window size but for its side-effect of correctly
// setting the COLUMNS and LINES env vars.