From 2418e1e50b636a3457b58a77feb0a2b14cbf82f9 Mon Sep 17 00:00:00 2001 From: Fabian Homborg Date: Mon, 25 Feb 2019 20:23:34 +0100 Subject: [PATCH] Don't mix up pgroup and pid This is another case where we used pid when we meant pgroup. Since 55b3c45f95ba09efa4b9eaad8ec49256a7435823, the assumption that both are the same no longer holds in all cases, so this check was wrong. Might fix #5663. --- src/reader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/reader.cpp b/src/reader.cpp index a370e2719..9821482d7 100644 --- a/src/reader.cpp +++ b/src/reader.cpp @@ -966,7 +966,7 @@ void reader_init() { /// Restore the term mode if we own the terminal. It's important we do this before /// restore_foreground_process_group, otherwise we won't think we own the terminal. void restore_term_mode() { - if (getpid() != tcgetpgrp(STDIN_FILENO)) return; + if (getpgrp() != tcgetpgrp(STDIN_FILENO)) return; if (tcsetattr(STDIN_FILENO, TCSANOW, &terminal_mode_on_startup) == -1 && errno == EIO) { redirect_tty_output();