Skip to main content

connect_with_remote_command

Function connect_with_remote_command 

Source
pub fn connect_with_remote_command(
    alias: &str,
    config_path: &Path,
    askpass: Option<&str>,
    bw_session: Option<&str>,
    has_active_tunnel: bool,
    remote_command: &str,
) -> Result<ConnectResult>
Expand description

Launch an SSH connection that runs a single remote command in interactive mode. Mirrors connect() exactly except for two additions: -t to allocate a TTY (required for the remote shell docker exec opens) and the trailing remote_command string passed to ssh as one argv slot. The remote shell receives the string as a single command line, so multi-token commands and shell operators like || work naturally.

Used by the containers overview Enter handler: the remote_command is built as <runtime> exec -it <container_id> sh -c 'bash || sh' where container_id has already been validated to alphanumeric + -_. so it cannot inject shell metacharacters.