Return error if ssh-config command fails

Update error detection to return an error if the process fails instead
of testing for content in stderr.
This commit is contained in:
Chris Roberts 2020-11-03 16:20:34 -08:00
parent 9ec55d3cd7
commit 8248f52ff7
1 changed files with 4 additions and 2 deletions

View File

@ -154,8 +154,10 @@ func (d *Vagrant_2_2_Driver) SSHConfig(id string) (*VagrantSSHConfig, error) {
sshConf := &VagrantSSHConfig{}
stdout, stderr, err := d.vagrantCmd(args...)
if err != nil {
if stderr != "" {
err := fmt.Errorf("ssh-config command returned error: %s", stderr)
err = fmt.Errorf("ssh-config command returned errors: %s", stderr)
}
return sshConf, err
}
lines := strings.Split(stdout, "\n")