Sanitize compiler name for environment variables (#10270)

While strictly speaking more characters are allowed, they are not usable in a shell except for uppercase / digits / underscore.
( https://stackoverflow.com/a/2821183 )
This commit is contained in:
Seba Kerckhof
2018-11-03 21:14:47 +01:00
committed by Ben Newman
parent f8e59735f6
commit 05ae386b79

View File

@@ -13,7 +13,9 @@ CachingCompilerBase = class CachingCompilerBase {
}) {
this._compilerName = compilerName;
this._maxParallelism = maxParallelism;
const envVarPrefix = 'METEOR_' + compilerName.toUpperCase() + '_CACHE_';
const compilerNameForEnvar = compilerName.toUpperCase()
.replace('/-/g', '_').replace(/[^A-Z0-9_]/g, '');
const envVarPrefix = 'METEOR_' + compilerNameForEnvar + '_CACHE_';
const debugEnvVar = envVarPrefix + 'DEBUG';
this._cacheDebugEnabled = !! process.env[debugEnvVar];