mirror of https://github.com/kivy/pyjnius.git
handle no java installed case based on exit code
This commit is contained in:
parent
e6ee4fdba3
commit
ad42b7ebf6
|
@ -1,7 +1,7 @@
|
|||
include "config.pxi"
|
||||
import os
|
||||
from shlex import split
|
||||
from subprocess import check_output
|
||||
from subprocess import check_output, CalledProcessError
|
||||
from os.path import dirname, join, exists
|
||||
from os import readlink
|
||||
from sys import platform
|
||||
|
@ -60,9 +60,14 @@ cdef find_java_home():
|
|||
if platform in ('darwin'):
|
||||
# its a mac
|
||||
if not exists('/usr/libexec/java_home'):
|
||||
# I believe this always exists, but just in case
|
||||
return
|
||||
try:
|
||||
java = check_output('/usr/libexec/java_home').strip().decode('utf8')
|
||||
return java
|
||||
except CalledProcessError as exc:
|
||||
# java_home return non-zero exit code if no Javas are installed
|
||||
return
|
||||
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue