From 48a1f7e55cdd1a38a72744ebccde63f353f779ab Mon Sep 17 00:00:00 2001 From: AnotherTest Date: Sun, 6 Dec 2020 20:52:08 +0330 Subject: [PATCH] Shell: Silence TCSETPGRP errors when not interactive --- Shell/Shell.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Shell/Shell.cpp b/Shell/Shell.cpp index af90756323..433e7f4ea3 100644 --- a/Shell/Shell.cpp +++ b/Shell/Shell.cpp @@ -817,13 +817,13 @@ RefPtr Shell::run_command(const AST::Command& command) pid_t pgid = is_first ? child : (command.pipeline ? command.pipeline->pgid : child); if ((!m_is_subshell && command.should_wait) || command.pipeline) { - if (setpgid(child, pgid) < 0) + if (setpgid(child, pgid) < 0 && m_is_interactive) perror("setpgid"); if (!m_is_subshell) { - if (tcsetpgrp(STDOUT_FILENO, pgid) != 0) + if (tcsetpgrp(STDOUT_FILENO, pgid) != 0 && m_is_interactive) perror("tcsetpgrp(OUT)"); - if (tcsetpgrp(STDIN_FILENO, pgid) != 0) + if (tcsetpgrp(STDIN_FILENO, pgid) != 0 && m_is_interactive) perror("tcsetpgrp(IN)"); } }