[core] Graceful fail when locate_java process returned nothing
Used when running a Hue command with -cm flag
@@ -169,9 +169,12 @@ def entry():
locate_java = subprocess.Popen(
['bash', '-c', '. /opt/cloudera/cm-agent/service/common/cloudera-config.sh; locate_java_home'],
stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ else:
+ locate_java = None
JAVA_HOME = "UNKNOWN"
+ if locate_java is not None:
for line in iter(locate_java.stdout.readline, ''):
if 'JAVA_HOME' in line:
JAVA_HOME = line.rstrip().split('=')[1]
