Shell runs an interactive secure shell over an existing port-forwarding session. It runs until the shell is terminated (including by cancellation of the context).
( ctx context.Context, p printer, sshArgs []string, command []string, port int, destination string, printConnDetails bool, )
| 19 | // port-forwarding session. It runs until the shell is terminated |
| 20 | // (including by cancellation of the context). |
| 21 | func Shell( |
| 22 | ctx context.Context, p printer, sshArgs []string, command []string, port int, destination string, printConnDetails bool, |
| 23 | ) error { |
| 24 | cmd, connArgs, err := newSSHCommand(ctx, port, destination, sshArgs, command) |
| 25 | if err != nil { |
| 26 | return fmt.Errorf("failed to create ssh command: %w", err) |
| 27 | } |
| 28 | |
| 29 | if printConnDetails { |
| 30 | p.Printf("Connection Details: ssh %s %s", destination, connArgs) |
| 31 | } |
| 32 | |
| 33 | return cmd.Run() |
| 34 | } |
| 35 | |
| 36 | // Copy runs an scp command over the specified port. scpArgs should contain both scp flags |
| 37 | // as well as the list of files to copy, with the flags first. |
no test coverage detected