From 9221a3decac8aa87106ee530232e710fe533d206 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Sun, 21 Mar 2021 10:26:04 +0100 Subject: [PATCH] Only set modes after config.fish if we're *interactive* 013a563ed0fc2cb400d914efffbeb8b87061673c made it so we only try to adjust terminal modes if we are in the terminal pgroup, but that's not enough. Fish starts background jobs in events inside its own pgroup, so function on-foo --on-event foo fish -c 'sleep 3' & end would have the backgrounded fish try to fiddle with the terminal and succeed. Instead, only fiddle with the terminal if we're interactive (this should probably be extended to other bits, but this is the particular problematic part) Fixes #7842. (cherry picked from commit e4fd664bbb75d5abde9e5ffebdcb4118c58be6c3) --- src/reader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/reader.cpp b/src/reader.cpp index b1167c2bc..25fcbf417 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -1342,7 +1342,7 @@ void reader_init() { // Set up our fixed terminal modes once, // so we don't get flow control just because we inherited it. - if (getpgrp() == tcgetpgrp(STDIN_FILENO)) { + if (is_interactive_session()) { term_donate(/* quiet */ true); }