equal
deleted
inserted
replaced
903 scriptpath = os.path.join(self._threadtmp, b'restoreenv.sh') |
903 scriptpath = os.path.join(self._threadtmp, b'restoreenv.sh') |
904 testenv['HGTEST_RESTOREENV'] = scriptpath |
904 testenv['HGTEST_RESTOREENV'] = scriptpath |
905 |
905 |
906 # Only restore environment variable names that the shell allows |
906 # Only restore environment variable names that the shell allows |
907 # us to export. |
907 # us to export. |
908 name_regex = re.compile('[a-zA-Z][a-zA-Z0-9_]*') |
908 name_regex = re.compile('^[a-zA-Z][a-zA-Z0-9_]*$') |
909 |
909 |
910 with open(scriptpath, 'w') as envf: |
910 with open(scriptpath, 'w') as envf: |
911 for name, value in os.environ.items(): |
911 for name, value in os.environ.items(): |
912 if not name_regex.match(name): |
912 if not name_regex.match(name): |
913 # Skip environment variables with unusual names not |
913 # Skip environment variables with unusual names not |