bugfix: TERM may not be in the environment on Cray (#15630)

This commit is contained in:
Todd Gamblin 2020-03-22 20:47:04 -07:00
parent a85cce05a1
commit 99bb88aead

View File

@ -117,9 +117,13 @@ def _default_target_from_env(self):
'''
# env -i /bin/bash -lc echo $CRAY_CPU_TARGET 2> /dev/null
if getattr(self, 'default', None) is None:
output = Executable('/bin/bash')('-lc', 'echo $CRAY_CPU_TARGET',
env={'TERM': os.environ['TERM']},
output=str, error=os.devnull)
bash = Executable('/bin/bash')
output = bash(
'-lc', 'echo $CRAY_CPU_TARGET',
env={'TERM': os.environ.get('TERM', '')},
output=str,
error=os.devnull
)
output = ''.join(output.split()) # remove all whitespace
if output:
self.default = output