From feb4f1b3876790c7455bb5899b48f88543a3c40f Mon Sep 17 00:00:00 2001
From: becker33 <becker33@llnl.gov>
Date: Thu, 21 Dec 2017 16:27:52 -0800
Subject: separate stdout and stderr for module loading (#6713)

---
 lib/spack/spack/util/module_cmd.py | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lib/spack/spack/util/module_cmd.py b/lib/spack/spack/util/module_cmd.py
index 00fc4ddc65..e5dc0f84a6 100644
--- a/lib/spack/spack/util/module_cmd.py
+++ b/lib/spack/spack/util/module_cmd.py
@@ -133,7 +133,10 @@ def load_module(mod):
             exec(compile(modulecmd('unload', text[i + 1], output=str,
                                    error=str), '<string>', 'exec'))
     # Load the module now that there are no conflicts
-    load = modulecmd('load', mod, output=str, error=str)
+    # Some module systems use stdout and some use stderr
+    load = modulecmd('load', mod, output=str, error='/dev/null')
+    if not load:
+        load = modulecmd('load', mod, error=str)
     exec(compile(load, '<string>', 'exec'))
 
 
-- 
cgit v1.2.3-70-g09d2