Avoid one record read

This commit is contained in:
Kovid Goyal
2022-02-27 20:45:19 +05:30
parent c0d5ace640
commit 95da414511
2 changed files with 21 additions and 17 deletions

View File

@@ -88,11 +88,12 @@ def make_tarfile(ssh_opts: SSHOptions, base_env: Dict[str, str]) -> bytes:
env[q] = val
env.update(ssh_opts.env)
env['KITTY_SHELL_INTEGRATION'] = ksi or DELETE_ENV_VAR
env['KITTY_SSH_KITTEN_DATA_DIR'] = ssh_opts.remote_dir
env_script = serialize_env(env, base_env)
buf = io.BytesIO()
with tarfile.open(mode='w:bz2', fileobj=buf, encoding='utf-8') as tf:
rd = ssh_opts.remote_dir.rstrip('/')
add_data_as_file(tf, rd + '/settings/env-vars.sh', env_script)
add_data_as_file(tf, 'kitty-ssh-kitten-data.sh', env_script)
if ksi:
tf.add(shell_integration_dir, arcname=rd + '/shell-integration', filter=filter_files)
tf.add(terminfo_dir, arcname='.terminfo', filter=filter_files)
@@ -145,7 +146,6 @@ def get_ssh_data(msg: str, ssh_opts: Optional[Dict[str, SSHOptions]] = None) ->
from base64 import standard_b64encode
encoded_data = standard_b64encode(data)
yield fmt_prefix(len(encoded_data))
yield fmt_prefix(resolved_ssh_opts.remote_dir)
yield encoded_data