MakeSSHCmdClient creates a new instance of SSHCmdClient
(client *ssh.Client, cmdSpec CommandSpec)
| 42 | |
| 43 | // MakeSSHCmdClient creates a new instance of SSHCmdClient |
| 44 | func MakeSSHCmdClient(client *ssh.Client, cmdSpec CommandSpec) (*SSHProcessController, error) { |
| 45 | log.Printf("SSH-NEWSESSION (cmdclient)\n") |
| 46 | session, err := client.NewSession() |
| 47 | if err != nil { |
| 48 | return nil, fmt.Errorf("failed to create SSH session: %w", err) |
| 49 | } |
| 50 | return &SSHProcessController{ |
| 51 | client: client, |
| 52 | lock: &sync.Mutex{}, |
| 53 | once: &sync.Once{}, |
| 54 | cmdSpec: cmdSpec, |
| 55 | session: session, |
| 56 | }, nil |
| 57 | } |
| 58 | |
| 59 | // Start begins execution of the command |
| 60 | func (s *SSHProcessController) Start() error { |
no outgoing calls
no test coverage detected