Fix various test failures

This commit is contained in:
Kovid Goyal 2023-02-24 17:28:48 +05:30
parent 3f417b26b2
commit 22ea33182a
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C
3 changed files with 13 additions and 6 deletions

View File

@ -472,7 +472,7 @@ var AllowedShellIntegrationValues = []string{{ {str(sorted(allowed_shell_integra
var KittyConfigDefaults = struct {{ var KittyConfigDefaults = struct {{
Term, Shell_integration string Term, Shell_integration string
}}{{ }}{{
Term: "{Options.term}", Shell_integration: "{Options.shell_integration}", Term: "{Options.term}", Shell_integration: "{' '.join(Options.shell_integration)}",
}} }}
''' # }}} ''' # }}}

View File

@ -119,7 +119,7 @@ copy --exclude */w.* d1
self.ae(len(glob.glob(f'{remote_home}/{tname}/*/xterm-kitty')), 2) self.ae(len(glob.glob(f'{remote_home}/{tname}/*/xterm-kitty')), 2)
def test_ssh_env_vars(self): def test_ssh_env_vars(self):
tset = '$A-$(echo no)-`echo no2` !Q5 "something\nelse"' tset = '$A-$(echo no)-`echo no2` !Q5 "something else"'
for sh in self.all_possible_sh: for sh in self.all_possible_sh:
with self.subTest(sh=sh), tempfile.TemporaryDirectory() as tdir: with self.subTest(sh=sh), tempfile.TemporaryDirectory() as tdir:
os.mkdir(os.path.join(tdir, 'cwd')) os.mkdir(os.path.join(tdir, 'cwd'))

View File

@ -217,6 +217,13 @@ func serialize_env(cd *connection_data, get_local_env func(string) (string, bool
} }
return nil return nil
} }
add_non_literal_env := func(key, val string, fallback ...string) *EnvInstruction {
ans := add_env(key, val, fallback...)
if ans != nil {
ans.literal_quote = false
}
return ans
}
for k, v := range cd.literal_env { for k, v := range cd.literal_env {
add_env(k, v) add_env(k, v)
} }
@ -230,9 +237,9 @@ func serialize_env(cd *connection_data, get_local_env func(string) (string, bool
} else { } else {
env = append(env, &EnvInstruction{key: "KITTY_SHELL_INTEGRATION", delete_on_remote: true}) env = append(env, &EnvInstruction{key: "KITTY_SHELL_INTEGRATION", delete_on_remote: true})
} }
add_env("KITTY_SSH_KITTEN_DATA_DIR", cd.host_opts.Remote_dir) add_non_literal_env("KITTY_SSH_KITTEN_DATA_DIR", cd.host_opts.Remote_dir)
add_env("KITTY_LOGIN_SHELL", cd.host_opts.Login_shell) add_non_literal_env("KITTY_LOGIN_SHELL", cd.host_opts.Login_shell)
add_env("KITTY_LOGIN_CWD", cd.host_opts.Cwd) add_non_literal_env("KITTY_LOGIN_CWD", cd.host_opts.Cwd)
if cd.host_opts.Remote_kitty != Remote_kitty_no { if cd.host_opts.Remote_kitty != Remote_kitty_no {
add_env("KITTY_REMOTE", cd.host_opts.Remote_kitty.String()) add_env("KITTY_REMOTE", cd.host_opts.Remote_kitty.String())
} }
@ -637,7 +644,7 @@ func test_integration_with_python(args []string) (rc int, err error) {
cd := &connection_data{ cd := &connection_data{
request_id: "testing", remote_args: []string{}, request_id: "testing", remote_args: []string{},
username: "testuser", hostname_for_match: "host.test", request_data: true, username: "testuser", hostname_for_match: "host.test", request_data: true,
test_script: args[0], test_script: args[0], echo_on: true,
} }
opts, err := load_config(cd.hostname_for_match, cd.username, nil, f.Name()) opts, err := load_config(cd.hostname_for_match, cd.username, nil, f.Name())
if err == nil { if err == nil {