diff options
author | Greg Becker <becker33@llnl.gov> | 2020-03-19 15:11:50 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-19 15:11:50 -0700 |
commit | e5f8b093a9c1b95ec30ba1a02777c91ad1a1805a (patch) | |
tree | 25cc7a8b5903da18509b87884ac0006618872675 | |
parent | a61c53a5c96c04d19116673e7c9d2bcc628c889e (diff) | |
download | spack-e5f8b093a9c1b95ec30ba1a02777c91ad1a1805a.tar.gz spack-e5f8b093a9c1b95ec30ba1a02777c91ad1a1805a.tar.bz2 spack-e5f8b093a9c1b95ec30ba1a02777c91ad1a1805a.tar.xz spack-e5f8b093a9c1b95ec30ba1a02777c91ad1a1805a.zip |
Cray bugfix: TERM missing while reading default target (#15381)
Bug: Spack hangs on some Cray machines
Reason: The TERM environment variable is necessary to run bash -lc "echo $CRAY_CPU_TARGET", but we run that command within env -i, which wipes the environment.
Fix: Manually forward the TERM environment variable to env -i /bin/bash -lc "echo $CRAY_CPU_TARGET"
-rw-r--r-- | lib/spack/spack/platforms/cray.py | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lib/spack/spack/platforms/cray.py b/lib/spack/spack/platforms/cray.py index cbeba96461..8eae51e66a 100644 --- a/lib/spack/spack/platforms/cray.py +++ b/lib/spack/spack/platforms/cray.py @@ -7,7 +7,7 @@ import os import re import llnl.util.tty as tty from spack.paths import build_env_path -from spack.util.executable import which +from spack.util.executable import Executable from spack.architecture import Platform, Target, NoPlatformError from spack.operating_systems.cray_frontend import CrayFrontend from spack.operating_systems.cnl import Cnl @@ -117,11 +117,13 @@ class Cray(Platform): ''' # env -i /bin/bash -lc echo $CRAY_CPU_TARGET 2> /dev/null if getattr(self, 'default', None) is None: - env = which('env') - output = env("-i", "/bin/bash", "-lc", "echo $CRAY_CPU_TARGET", - output=str, error=os.devnull) - self.default = output.strip() - tty.debug("Found default module:%s" % self.default) + output = Executable('/bin/bash')('-lc', 'echo $CRAY_CPU_TARGET', + env={'TERM': os.environ['TERM']}, + output=str, error=os.devnull) + output = ''.join(output.split()) # remove all whitespace + if output: + self.default = output + tty.debug("Found default module:%s" % self.default) return self.default def _avail_targets(self): |