[Audio] Match openJDK 11 on Ubuntu (#2270)

Using the OpenJDK 11 from java.net on Ubuntu 18 reports "11" as the version, which failed the Java version check on loading audio on a new instance. This change will return "11 0" as the version, passing the check, instead of just "11".
This commit is contained in:
aikaterna 2018-11-23 15:45:37 -08:00 committed by Toby Harradine
parent bbccb671b8
commit 6435f6b882

View File

@ -72,12 +72,16 @@ async def get_java_version(loop) -> _JavaVersion:
# ... # ...
# We only care about the major and minor parts though. # We only care about the major and minor parts though.
version_line_re = re.compile(r'version "(?P<major>\d+).(?P<minor>\d+).\d+(?:_\d+)?"') version_line_re = re.compile(r'version "(?P<major>\d+).(?P<minor>\d+).\d+(?:_\d+)?"')
short_version_re = re.compile(r'version "(?P<major>\d+)"')
lines = version_info.splitlines() lines = version_info.splitlines()
for line in lines: for line in lines:
match = version_line_re.search(line) match = version_line_re.search(line)
short_match = short_version_re.search(line)
if match: if match:
return int(match["major"]), int(match["minor"]) return int(match["major"]), int(match["minor"])
elif short_match:
return int(short_match["major"]), 0
raise RuntimeError( raise RuntimeError(
"The output of `java -version` was unexpected. Please report this issue on Red's " "The output of `java -version` was unexpected. Please report this issue on Red's "