Ejemplo n.º 1
0
// getVmrunVersion returns version information of the used vmrun executable
func getVmrunVersion(
	vmrun vmware.VmrunWrapper) (*vmrunVersion, error) {
	help, err := vmrun.Help()
	if err != nil {
		return nil, err
	}

	matches := helpVmrunVersion.FindStringSubmatch(help)
	if len(matches) < 3 {
		return nil, fmt.Errorf("Could not parse vmrun version information")
	}
	result := new(vmrunVersion)
	// index 0 is the whole match itself
	result.version = matches[1]
	result.build = matches[2]
	return result, nil
}