Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Associate external commands in functions with extant pgrps
When a function is encountered by exec_job, a new context is created for its execution from the ground up, with a new job and all, ultimately resulting in a recursive call to exec_job from the same (main) thread. Since each time exec_job encounters a new job with external commands that needs terminal control it creates a new pgrp and gives it control of the terminal (tcsetpgrp & co), this effectively takes control away from the previously spawned external commands which may be (and likely are) expecting to still have terminal access. This commit attempts to detect when such a situation arises by handling recursive calls to exec_job (which can only happen if the pipeline included a function) by borrowing the pgrp from the (necessarily still active) parent job and spawning new external commands into it. Closes fish-shell#3952.
- Loading branch information