1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-16 02:24:59 +00:00

Shell: Silence TCSETPGRP errors when not interactive

This commit is contained in:
AnotherTest 2020-12-06 20:52:08 +03:30 committed by Andreas Kling
parent 57728ef29f
commit 48a1f7e55c

View file

@ -817,13 +817,13 @@ RefPtr<Job> 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)");
}
}