Repository navigation
Acquire tty if interactive when running builtins - #5133
Merged
Merged
Conversation
When running a builtin, if we are an interactive shell and stdin is a tty, then acquire ownership of the terminal via tcgetpgrp() before running the builtin, and set it back after. Fixes fish-shell#4540
Member
|
Looks good here on Debian 8 (Linux 4.9.0-5-amd64, Debian GLIBC 2.24-11+deb9u3, tmux 2.3). |
|
Doesn't seem to fix #4540 for me, presumably something to do with the fact that my prompt shows Git info: |
Closed
ridiculousfish
added a commit
to ridiculousfish/fish-shell
that referenced
this pull request
Jan 31, 2020
fish has some unprincipled code that attempts to tcsetpgrp() to own the terminal before running a builtin; this was added because 'read' might want to read from the terminal. I added this code before fully understanding how process groups and terminals work. A better fix would be to ensure that fish is marked as the pgroup leader in the job when the builtin is the first process in the job, and we do that now. Courageously back out the changes to grab the terminal; see fish-shell#5147 and also fish-shell#5133.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When running a builtin, if we are an interactive shell and stdin is a tty,
then acquire ownership of the terminal via tcgetpgrp() before running the
builtin, and set it back after.
I don't know how principled this fix is because job control is quite confusing.
But it's certainly true that when running builtins interactively, we expect to own
the terminal, so I don't believe this can make anything worse.
Fixes #4540