MCPcopy Create free account
hub / github.com/NVIDIA/OpenShell / start_shell

Method start_shell

crates/openshell-supervisor-process/src/ssh.rs:541–589  ·  view source on GitHub ↗
(
        &mut self,
        channel: ChannelId,
        handle: Handle,
        command: Option<String>,
    )

Source from the content-addressed store, hash-verified

539
540impl SshHandler {
541 fn start_shell(
542 &mut self,
543 channel: ChannelId,
544 handle: Handle,
545 command: Option<String>,
546 ) -> anyhow::Result<()> {
547 let provider_env = self.provider_credentials.child_env_with_gcp_resolved();
548 let state = self
549 .channels
550 .get_mut(&channel)
551 .ok_or_else(|| anyhow::anyhow!("start_shell on unknown channel {channel:?}"))?;
552 if let Some(pty) = state.pty_request.take() {
553 // PTY was requested — allocate a real PTY (interactive shell or
554 // exec that explicitly asked for a terminal).
555 let (pty_master, input_sender) = spawn_pty_shell(
556 &self.policy,
557 self.workdir.clone(),
558 command,
559 &pty,
560 handle,
561 channel,
562 self.netns_fd,
563 self.proxy_url.clone(),
564 self.ca_file_paths.clone(),
565 &provider_env,
566 &self.user_environment,
567 )?;
568 state.pty_master = Some(pty_master);
569 state.input_sender = Some(input_sender);
570 } else {
571 // No PTY requested — use plain pipes so stdout/stderr are
572 // separate and output has clean LF line endings. This is the
573 // path VSCode Remote-SSH exec commands take.
574 let input_sender = spawn_pipe_exec(
575 &self.policy,
576 self.workdir.clone(),
577 command,
578 handle,
579 channel,
580 self.netns_fd,
581 self.proxy_url.clone(),
582 self.ca_file_paths.clone(),
583 &provider_env,
584 &self.user_environment,
585 )?;
586 state.input_sender = Some(input_sender);
587 }
588 Ok(())
589 }
590}
591
592/// Connect a TCP stream to `addr` inside the sandbox network namespace.

Callers 2

shell_requestMethod · 0.80
exec_requestMethod · 0.80

Calls 3

spawn_pty_shellFunction · 0.85
spawn_pipe_execFunction · 0.85

Tested by

no test coverage detected