fix(pty): Always use $TERM from the job's env dict #13876
Merged
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.
Before #12937, the only way to specify the
$TERMfor a pty job was through theTERMkey in the job's opts dict. This was shuttled to the child process throug a special field on the PtyProcess object and injected into the environment after forking.Now that we have a proper way to specify the environment for a job, we can simply ensure that the env dict has a proper
TERMset and avoid the extra shuttling of data around.This deprecates the use of the
TERMoption, but will still honor it if present, although at a lower priority than aTERMpresent in the env dict.This also fixes #13874 because we're no longer trying to overwrite
TERMin the env dict with the special ptyterm_name. Doing so raises an internal error because of the existing key which, under certain circumstances, would cause the "hit enter" prompt. However, since the child process had already forked, there was no way for the user to acknowledge the prompt and we would just hang there.