()
| 43 | } |
| 44 | |
| 45 | func NewSSHExe() (SSHExe, error) { |
| 46 | var sshExe SSHExe |
| 47 | |
| 48 | if sshShell := os.Getenv(EnvShellSSH); sshShell != "" { |
| 49 | sshShellFields, err := shellwords.Parse(sshShell) |
| 50 | switch { |
| 51 | case err != nil: |
| 52 | logrus.WithError(err).Warnf("Failed to split %s variable into shell tokens. "+ |
| 53 | "Falling back to 'ssh' command", EnvShellSSH) |
| 54 | case len(sshShellFields) > 0: |
| 55 | sshExe.Exe = sshShellFields[0] |
| 56 | if len(sshShellFields) > 1 { |
| 57 | sshExe.Args = sshShellFields[1:] |
| 58 | } |
| 59 | return sshExe, nil |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | executable, err := exec.LookPath("ssh") |
| 64 | if err != nil { |
| 65 | return SSHExe{}, err |
| 66 | } |
| 67 | sshExe.Exe = executable |
| 68 | |
| 69 | return sshExe, nil |
| 70 | } |
| 71 | |
| 72 | type PubKey struct { |
| 73 | Filename string |
no outgoing calls
no test coverage detected