@@ -2015,10 +2015,16 @@ def as_launch_command(self, ser_opts: SaveAsSessionOptions, cwd: str, is_overlay
20152015 t = 'overlay-main' if self .overlay_type is OverlayType .main else 'overlay'
20162016 ans .append (f'--type={ t } ' )
20172017
2018+ from kittens .ssh .utils import is_kitten_cmdline as is_ssh_kitten_cmdline
2019+ from kittens .ssh .utils import remove_env_var_from_cmdline , set_cwd_in_cmdline , set_single_env_var_in_cmdline
20182020 cmd : list [str ] = []
20192021 if self .creation_spec and self .creation_spec .cmd :
20202022 if self .creation_spec .cmd != resolved_shell (get_options ()):
20212023 cmd = self .creation_spec .cmd
2024+ if is_ssh_kitten_cmdline (cmd ):
2025+ if self .at_prompt :
2026+ if self .screen .last_reported_cwd :
2027+ set_cwd_in_cmdline (path_from_osc7_url (self .screen .last_reported_cwd ), cmd )
20222028 unserialize_data : dict [str , int | list [str ] | str ] = {'id' : self .id }
20232029 if not cmd and ser_opts .use_foreground_process :
20242030 def make_exe_absolute (cmd : list [str ], pid : int ) -> None :
@@ -2028,7 +2034,6 @@ def make_exe_absolute(cmd: list[str], pid: int) -> None:
20282034 cmd [0 ] = abspath_of_exe (pid )
20292035 kssh_cmdline = self .ssh_kitten_cmdline ()
20302036 if kssh_cmdline :
2031- from kittens .ssh .utils import remove_env_var_from_cmdline , set_cwd_in_cmdline , set_single_env_var_in_cmdline
20322037 remove_env_var_from_cmdline ('KITTY_SI_RUN_COMMAND_AT_STARTUP' , kssh_cmdline )
20332038 if self .at_prompt :
20342039 if self .screen .last_reported_cwd :
0 commit comments