execInteractiveShell runs the ssh binary interactively with the given argument list, inheriting stdin/stdout/stderr. Unlike the TUI's ssh helpers it does not display a "Press Enter to return to TUI" prompt on exit.
(sshArgs []string, keyfile string)
| 507 | // argument list, inheriting stdin/stdout/stderr. Unlike the TUI's ssh helpers |
| 508 | // it does not display a "Press Enter to return to TUI" prompt on exit. |
| 509 | func execInteractiveShell(sshArgs []string, keyfile string) error { |
| 510 | args := make([]string, 0, len(sshArgs)+2) |
| 511 | if keyfile != "" { |
| 512 | args = append(args, "-i", keyfile) |
| 513 | } |
| 514 | |
| 515 | args = append(args, sshArgs...) |
| 516 | |
| 517 | // #nosec G204 -- args are built from vetted internal call sites. |
| 518 | cmd := exec.Command("ssh", args...) |
| 519 | cmd.Stdin = os.Stdin |
| 520 | cmd.Stdout = os.Stdout |
| 521 | cmd.Stderr = os.Stderr |
| 522 | cmd.Env = append(os.Environ(), "TERM=xterm-256color") |
| 523 | |
| 524 | return cmd.Run() |
| 525 | } |
| 526 | |
| 527 | // completeNodeNames is a Cobra ValidArgsFunction that returns node names for |
| 528 | // tab completion. It requires no positional args already provided. |
no test coverage detected