fix value escaping in codeql-env.sh
This commit is contained in:
parent
46d0d277ef
commit
e7e64d59be
3 changed files with 3 additions and 3 deletions
2
lib/runner.js
generated
2
lib/runner.js
generated
|
|
@ -150,7 +150,7 @@ program
|
||||||
const shEnvFile = path.join(config.tempDir, "codeql-env.sh");
|
const shEnvFile = path.join(config.tempDir, "codeql-env.sh");
|
||||||
const shEnvFileContents = Object.entries(tracerConfig.env)
|
const shEnvFileContents = Object.entries(tracerConfig.env)
|
||||||
// Some vars contain ${LIB} that we do not want to be expanded when executing this script
|
// Some vars contain ${LIB} that we do not want to be expanded when executing this script
|
||||||
.map(([key, value]) => `export ${key}="${value.replace(/\$/g, "\\$")}"`)
|
.map(([key, value]) => `export ${key}='${value.replace(/'/g, "'\"'\"'")}'`)
|
||||||
.join("\n");
|
.join("\n");
|
||||||
fs.writeFileSync(shEnvFile, shEnvFileContents);
|
fs.writeFileSync(shEnvFile, shEnvFileContents);
|
||||||
logger.info(`\nCodeQL environment output to "${jsonEnvFile}" and "${shEnvFile}". ` +
|
logger.info(`\nCodeQL environment output to "${jsonEnvFile}" and "${shEnvFile}". ` +
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -249,7 +249,7 @@ program
|
||||||
const shEnvFileContents = Object.entries(tracerConfig.env)
|
const shEnvFileContents = Object.entries(tracerConfig.env)
|
||||||
// Some vars contain ${LIB} that we do not want to be expanded when executing this script
|
// Some vars contain ${LIB} that we do not want to be expanded when executing this script
|
||||||
.map(
|
.map(
|
||||||
([key, value]) => `export ${key}="${value.replace(/\$/g, "\\$")}"`
|
([key, value]) => `export ${key}='${value.replace(/'/g, "'\"'\"'")}'`
|
||||||
)
|
)
|
||||||
.join("\n");
|
.join("\n");
|
||||||
fs.writeFileSync(shEnvFile, shEnvFileContents);
|
fs.writeFileSync(shEnvFile, shEnvFileContents);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue