builder/virtualbox: trim whitespace when getting version
This commit is contained in:
parent
19f757a273
commit
9cf78edcf0
|
@ -13,6 +13,7 @@ IMPROVEMENTS:
|
||||||
BUG FIXES:
|
BUG FIXES:
|
||||||
|
|
||||||
* core: More plugin server fixes that avoid hangs on OS X 10.7 [GH-87]
|
* core: More plugin server fixes that avoid hangs on OS X 10.7 [GH-87]
|
||||||
|
* virtualbox: More robust version parsing for uploading guest additions. [GH-69]
|
||||||
|
|
||||||
## 0.1.2 (June 29, 2013)
|
## 0.1.2 (June 29, 2013)
|
||||||
|
|
||||||
|
|
|
@ -124,11 +124,12 @@ func (d *VBox42Driver) Version() (string, error) {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("VBoxManage --version output: %s", stdout.String())
|
versionOutput := strings.TrimSpace(stdout.String())
|
||||||
|
log.Printf("VBoxManage --version output: %s", versionOutput)
|
||||||
versionRe := regexp.MustCompile("[^.0-9]")
|
versionRe := regexp.MustCompile("[^.0-9]")
|
||||||
matches := versionRe.Split(stdout.String(), 2)
|
matches := versionRe.Split(versionOutput, 2)
|
||||||
if len(matches) == 0 {
|
if len(matches) == 0 {
|
||||||
return "", fmt.Errorf("No version found: %s", stdout.String())
|
return "", fmt.Errorf("No version found: %s", versionOutput)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Printf("VirtualBox version: %s", matches[0])
|
log.Printf("VirtualBox version: %s", matches[0])
|
||||||
|
|
Loading…
Reference in New Issue