From 96063f9168e4235df41ab6738aa8c0cfec260f5f Mon Sep 17 00:00:00 2001
From: Sajid Ali <30510036+s-sajid-ali@users.noreply.github.com>
Date: Sat, 21 Dec 2019 02:02:28 -0600
Subject: [PATCH] use `sys.executable` instead of `python` in
 `_source_single_file` (#14252)

---
 lib/spack/spack/util/environment.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/spack/spack/util/environment.py b/lib/spack/spack/util/environment.py
index b85ec963e2..f7dc728e7c 100644
--- a/lib/spack/spack/util/environment.py
+++ b/lib/spack/spack/util/environment.py
@@ -919,7 +919,7 @@ def _source_single_file(file_and_args, environment):
         source_file = ' '.join(source_file)
 
         dump_cmd = 'import os, json; print(json.dumps(dict(os.environ)))'
-        dump_environment = 'python -c "{0}"'.format(dump_cmd)
+        dump_environment = sys.executable + ' -c "{0}"'.format(dump_cmd)
 
         # Try to source the file
         source_file_arguments = ' '.join([
-- 
GitLab