Skip to content

Commit

Permalink
Rollup merge of rust-lang#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 rust-lang#93344
# Info
Allows usage of sudo (while not accessing root) in x.py
  • Loading branch information
Dylan-DPC committed Apr 11, 2022
2 parents 2abbdec + 386ca6a commit c18613f
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 @@ -1172,9 +1172,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 c18613f

Please sign in to comment.