Commit 9cf78edc authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

builder/virtualbox: trim whitespace when getting version

parent 19f757a2
......@@ -13,6 +13,7 @@ IMPROVEMENTS:
BUG FIXES:
* 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)
......
......@@ -124,11 +124,12 @@ func (d *VBox42Driver) Version() (string, error) {
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]")
matches := versionRe.Split(stdout.String(), 2)
matches := versionRe.Split(versionOutput, 2)
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])
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment