Commit 2575b09d authored by Mitchell Hashimoto's avatar Mitchell Hashimoto

Merge pull request #1570 from kouk/master

figure out VirtualBox version on FreeBSD
parents 607f7214 a8b86582
...@@ -195,12 +195,12 @@ func (d *VBox42Driver) Version() (string, error) { ...@@ -195,12 +195,12 @@ func (d *VBox42Driver) Version() (string, error) {
return "", fmt.Errorf("VirtualBox is not properly setup: %s", versionOutput) return "", fmt.Errorf("VirtualBox is not properly setup: %s", versionOutput)
} }
versionRe := regexp.MustCompile("^[.0-9]+(?:_RC[0-9]+)?") versionRe := regexp.MustCompile("^([.0-9]+)(?:_(?:RC|OSEr)[0-9]+)?")
matches := versionRe.FindAllString(versionOutput, 1) matches := versionRe.FindAllStringSubmatch(versionOutput, 1)
if matches == nil { if matches == nil || len(matches[0]) != 2 {
return "", fmt.Errorf("No version found: %s", versionOutput) return "", fmt.Errorf("No version found: %s", versionOutput)
} }
log.Printf("VirtualBox version: %s", matches[0]) log.Printf("VirtualBox version: %s", matches[0][1])
return matches[0], nil return matches[0][1], nil
} }
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