builtins to only acquire terminal if owned by their pgroup

Fix #5133 changed builtins to acquire the terminal, but this regressed
caused fish to be stopped when running in background via `sudo fish`.
Fix this by only acquiring the terminal if the terminal was owned by the
builtin's pgroup.

Fixes #5147
This commit is contained in:
ridiculousfish
2018-08-18 16:56:01 -07:00
parent cbcabf6d00
commit d9f34147c3
5 changed files with 9 additions and 9 deletions

View File

@@ -484,7 +484,7 @@ static bool exec_internal_builtin_proc(parser_t &parser, job_t *j, process_t *p,
j->set_flag(JOB_FOREGROUND, false);
// Note this call may block for a long time, while the builtin performs I/O.
p->status = builtin_run(parser, p->get_argv(), streams);
p->status = builtin_run(parser, j->pgid, p->get_argv(), streams);
// Restore the fg flag, which is temporarily set to false during builtin
// execution so as not to confuse some job-handling builtins.