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 committed by GitHub
parent d9c5b7de10
commit 0323f84e79
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

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