mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-06-11 10:18:15 +09:00
Shell: Move the first command in a pipeline to the pipeline pgid too
This process is supposed to be the session leader of the pipeline process group, we can't *not* move it into that group :P
This commit is contained in:
parent
d366e996dd
commit
063fb02ef4
Notes:
sideshowbarker
2024-07-19 02:42:54 +09:00
Author: https://github.com/alimpfard
Commit: 063fb02ef4
Pull-request: https://github.com/SerenityOS/serenity/pull/3469
1 changed files with 5 additions and 3 deletions
|
@ -622,12 +622,14 @@ RefPtr<Job> Shell::run_command(const AST::Command& command)
|
||||||
}
|
}
|
||||||
|
|
||||||
pid_t pgid = is_first ? child : (command.pipeline ? command.pipeline->pgid : child);
|
pid_t pgid = is_first ? child : (command.pipeline ? command.pipeline->pgid : child);
|
||||||
if (!m_is_subshell && command.should_wait) {
|
if ((!m_is_subshell && command.should_wait) || command.pipeline) {
|
||||||
if (setpgid(child, pgid) < 0)
|
if (setpgid(child, pgid) < 0)
|
||||||
perror("setpgid");
|
perror("setpgid");
|
||||||
|
|
||||||
tcsetpgrp(STDOUT_FILENO, pgid);
|
if (!m_is_subshell) {
|
||||||
tcsetpgrp(STDIN_FILENO, pgid);
|
tcsetpgrp(STDOUT_FILENO, pgid);
|
||||||
|
tcsetpgrp(STDIN_FILENO, pgid);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (write(sync_pipe[1], "x", 1) < 0) {
|
while (write(sync_pipe[1], "x", 1) < 0) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue