1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 10:18:11 +00:00

Shell: Don't whine about tcsetpgrp() failing

We intentionally skimp out on checking isatty() before them to cut down
on syscalls, so we should also accept the errors and just let them be.
Closes #6471.
This commit is contained in:
Ali Mohammad Pur 2021-04-19 14:35:21 +04:30 committed by Linus Groh
parent 74f0fdab98
commit efb14e95c4

View file

@ -822,10 +822,12 @@ RefPtr<Job> Shell::run_command(const AST::Command& command)
perror("setpgid");
if (!m_is_subshell) {
if (tcsetpgrp(STDOUT_FILENO, pgid) != 0 && m_is_interactive)
perror("tcsetpgrp(OUT)");
if (tcsetpgrp(STDIN_FILENO, pgid) != 0 && m_is_interactive)
perror("tcsetpgrp(IN)");
// There's no reason to care about the errors here
// either we're in a tty, we're interactive, and this works
// or we're not, and it fails - in which case, we don't need
// stdin/stdout handoff to child processes anyway.
tcsetpgrp(STDOUT_FILENO, pgid);
tcsetpgrp(STDIN_FILENO, pgid);
}
}