squakez commented on code in PR #5440: URL: https://github.com/apache/camel-k/pull/5440#discussion_r1584935643
########## script/check_jdk_version.go: ########## @@ -0,0 +1,33 @@ +package main + +import ( + "fmt" + "os/exec" + "regexp" + "strconv" +) + +func main() { + + cmd := exec.Command("java", "-version") + output, err := cmd.CombinedOutput() + if err != nil { + panic(fmt.Sprintf("Error: %v\n", err)) + } + + versionStr := string(output) + versionRegex := regexp.MustCompile(`version "?([1-9]+)(\.([0-9]+)){2,3}"?`) + matches := versionRegex.FindStringSubmatch(versionStr) + if len(matches) < 2 { + panic(fmt.Sprintf("Unable to determine Java version: %s\n", versionStr)) Review Comment: Okey. Still make sure any parsing problem is not leading to a panic which would impede to complete a build. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: commits-unsubscr...@camel.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org