about summary refs log tree commit diff
diff options
context:
space:
mode:
authorfee1-dead <ent3rm4n@gmail.com>2022-04-12 22:44:41 +1000
committerGitHub <noreply@github.com>2022-04-12 22:44:41 +1000
commitae068e78c0635f4d245861ed8258435da20a733d (patch)
tree739c6b33a2bc4ac6322821afe2fb481a772725b9
parent4e1927db3c399fa34dc71992bd5dbec09f945c3d (diff)
parent386ca6acc358fc81028680a45c8f3695c2988fef (diff)
downloadrust-ae068e78c0635f4d245861ed8258435da20a733d.tar.gz
rust-ae068e78c0635f4d245861ed8258435da20a733d.zip
Rollup merge of #95671 - gimbles:master, r=Mark-Simulacrum
feat: Allow usage of sudo [while not accessing root] in x.py

# Fixes
This PR should fix #93344
# Info
Allows usage of sudo (while not accessing root) in x.py
-rw-r--r--src/bootstrap/bootstrap.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/bootstrap/bootstrap.py b/src/bootstrap/bootstrap.py
index 54b6750cc4d..9af0657caff 100644
--- a/src/bootstrap/bootstrap.py
+++ b/src/bootstrap/bootstrap.py
@@ -1173,9 +1173,9 @@ class RustBuild(object):
         """Check that vendoring is configured properly"""
         vendor_dir = os.path.join(self.rust_root, 'vendor')
         if 'SUDO_USER' in os.environ and not self.use_vendored_sources:
-            if os.environ.get('USER') != os.environ['SUDO_USER']:
+            if os.getuid() == 0:
                 self.use_vendored_sources = True
-                print('info: looks like you are running this command under `sudo`')
+                print('info: looks like you\'re trying to run this command as root')
                 print('      and so in order to preserve your $HOME this will now')
                 print('      use vendored sources by default.')
                 if not os.path.exists(vendor_dir):