Skip to content

Commit

Permalink
Rollup merge of #95671 - gimbles:master, r=Mark-Simulacrum
Browse files Browse the repository at this point in the history
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
  • Loading branch information
fee1-dead authored Apr 12, 2022
2 parents 4e1927d + 386ca6a commit ae068e7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/bootstrap/bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -1173,9 +1173,9 @@ def check_vendored_status(self):
"""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):
Expand Down

0 comments on commit ae068e7

Please sign in to comment.