Skip to content

Commit cedf70a

Browse files
Trivial: Cast dockerCmd string replace to string. (#1590)
Issue: with one of my gitlab pipelines, our usage of service directives over parallel executors was causing node errors to be raised when trying to replace dockerCmd strings that for some reason were not strings. Solution: Force casting the values to be string representations in all cases fixed the issue I was having and is a safer call to make. Co-authored-by: Edward Thomason <[email protected]>
1 parent 60b8f78 commit cedf70a

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/job.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -907,7 +907,7 @@ export class Job {
907907

908908
for (const [key, val] of Object.entries(expanded)) {
909909
// Replacing `'` with `'\''` to correctly handle single quotes(if `val` contains `'`) in shell commands
910-
dockerCmd += ` -e '${key}=${val.replace(/'/g, "'\\''")}' \\\n`;
910+
dockerCmd += ` -e '${key}=${val.toString().replace(/'/g, "'\\''")}' \\\n`;
911911
}
912912

913913
if (this.imageEntrypoint) {
@@ -1437,7 +1437,7 @@ export class Job {
14371437

14381438
for (const [key, val] of Object.entries(expanded)) {
14391439
// Replacing `'` with `'\''` to correctly handle single quotes(if `val` contains `'`) in shell commands
1440-
dockerCmd += ` -e '${key}=${val.replace(/'/g, "'\\''")}' \\\n`;
1440+
dockerCmd += ` -e '${key}=${val.toString().replace(/'/g, "'\\''")}' \\\n`;
14411441
}
14421442

14431443
const serviceEntrypoint = service.entrypoint;

0 commit comments

Comments
 (0)