Skip environment variables such as SSH_TTY when using clone-in-kitty

This commit is contained in:
pagedown 2022-04-15 19:43:40 +08:00
parent 716813e38a
commit 9c855a8377
No known key found for this signature in database
GPG Key ID: E921CF18AC8FF6EB

View File

@ -567,9 +567,13 @@ class CloneCmd:
self.args.append(v) self.args.append(v)
elif k == 'env': elif k == 'env':
self.env = parse_bash_env(v) if self.envfmt == 'bash' else parse_null_env(v) self.env = parse_bash_env(v) if self.envfmt == 'bash' else parse_null_env(v)
for filtered in ('PS0', 'PS1', 'PS2', 'PS3', 'PS4', 'RPS1', 'PROMPT_COMMAND'): for filtered in (
# some people export these. We want the shell rc files to # some people export these. We want the shell rc files to
# recreate them # recreate them
'PS0', 'PS1', 'PS2', 'PS3', 'PS4', 'RPS1', 'PROMPT_COMMAND', 'SHLVL',
# skip SSH environment variables
'SSH_CLIENT', 'SSH_CONNECTION', 'SSH_ORIGINAL_COMMAND', 'SSH_TTY', 'SSH2_TTY',
):
self.env.pop(filtered, None) self.env.pop(filtered, None)
elif k == 'cwd': elif k == 'cwd':
self.cwd = v self.cwd = v