figure out VirtualBox version on FreeBSD

This commit is contained in:
Konstantinos Koukopoulos 2014-10-09 11:45:03 +03:00
parent 22b186ce15
commit a8b8658245
1 changed files with 5 additions and 5 deletions

View File

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