diff --git a/lib/spack/spack/compiler.py b/lib/spack/spack/compiler.py
index b9abf943e80ea2204ba97cb6604a6dbbab37bc84..a665f6062d2826a94eb6bbf9250300b6aa870c18 100644
--- a/lib/spack/spack/compiler.py
+++ b/lib/spack/spack/compiler.py
@@ -51,7 +51,7 @@ def _verify_executables(*paths):
 def get_compiler_version(compiler_path, version_arg, regex='(.*)'):
     if not compiler_path in _version_cache:
         compiler = Executable(compiler_path)
-        output = compiler(version_arg, return_output=True, error=None)
+        output = compiler(version_arg, return_output=True, error=os.devnull)
 
         match = re.search(regex, output)
         _version_cache[compiler_path] = match.group(1) if match else 'unknown'
diff --git a/lib/spack/spack/util/executable.py b/lib/spack/spack/util/executable.py
index 35bf08661622954c65584148e4b24d5820eda02c..ba765eb662988021b04ebd56c01c0bcf664f77eb 100644
--- a/lib/spack/spack/util/executable.py
+++ b/lib/spack/spack/util/executable.py
@@ -60,16 +60,16 @@ def __call__(self, *args, **kwargs):
         fail_on_error = kwargs.get("fail_on_error", True)
         ignore_errors = kwargs.get("ignore_errors", ())
 
-        output        = kwargs.get("output", sys.stdout)
-        error         = kwargs.get("error", sys.stderr)
+        # Default values of None says to keep parent's file descriptors.
+        output        = kwargs.get("output", None)
+        error         = kwargs.get("error", None)
         input         = kwargs.get("input", None)
 
         def streamify(arg, mode):
             if isinstance(arg, basestring):
                 return open(arg, mode), True
-            elif arg is None and mode != 'r':
-                return open(os.devnull, mode), True
-            return arg, False
+            else:
+                return arg, False
         output, ostream = streamify(output, 'w')
         error,  estream = streamify(error,  'w')
         input,  istream = streamify(input,  'r')
@@ -92,19 +92,14 @@ def streamify(arg, mode):
         tty.debug(cmd_line)
 
         try:
+            if return_output:
+                output = subprocess.PIPE
+
             proc = subprocess.Popen(
-                cmd,
-                stdin=input,
-                stderr=subprocess.PIPE,
-                stdout=subprocess.PIPE)
+                cmd, stdin=input, stderr=error, stdout=output)
             out, err = proc.communicate()
-            self.returncode = proc.returncode
-
-            if not return_output:
-                output.write(out)
-            error.write(err)
 
-            rc = proc.returncode
+            rc = self.returncode = proc.returncode
             if fail_on_error and rc != 0 and (rc not in ignore_errors):
                 raise ProcessError("Command exited with status %d:"
                                    % proc.returncode, cmd_line)