@@ -418,9 +418,12 @@ func prepare_remote_cmd(cd *connection_data) string {
418418
419419 remote_command := cd .ssh_config .RemoteCommand
420420 if cd .script_type == "py" {
421- return base64 .RawStdEncoding .EncodeToString (utils .UnsafeStringToBytes (remote_command ))
421+ return base64 .StdEncoding .EncodeToString (utils .UnsafeStringToBytes (remote_command ))
422422 }
423- return remote_command
423+ if remote_command == "" {
424+ return ""
425+ }
426+ return remote_command + "\n \n exit"
424427}
425428
426429var data_shm shm.MMap
@@ -435,6 +438,7 @@ func prepare_script(script string, replacements map[string]string) string {
435438 if _ , found := replacements ["REMOTE_CMD" ]; ! found {
436439 replacements ["REMOTE_CMD" ] = ""
437440 }
441+ replacements ["HAS_REMOTE_CMD" ] = utils .IfElse (replacements ["REMOTE_CMD" ] == "" , "n" , "y" )
438442 keys := utils .Keys (replacements )
439443 for i , key := range keys {
440444 keys [i ] = "\\ b" + key + "\\ b"
@@ -640,7 +644,6 @@ func run_ssh(ssh_args, server_args, found_extra_args []string, ssh_config_channe
640644 }
641645 insertion_point := len (cmd )
642646 cmd = append (cmd , "--" , hostname )
643- cmd = slices .Insert (cmd , insertion_point , "-o" , "RemoteCommand=none" )
644647 uname , hostname_for_match := get_destination (hostname )
645648 overrides , literal_env , err := parse_kitten_args (found_extra_args , uname , hostname_for_match )
646649 if err != nil {
0 commit comments