Skip to content

Commit

Permalink
fixed a bug that caused --containername to not work
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitri-trofimov committed Jun 24, 2022
1 parent b67e023 commit 01273f5
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions mega-linter-runner/lib/runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,12 @@ ERROR: Docker engine has not been found on your system.

// Build docker run options
const lintPath = path.resolve(options.path || ".");
const commandArgs = [
"run",
"-v",
"/var/run/docker.sock:/var/run/docker.sock:rw",
"-v",
`${lintPath}:/tmp/lint:rw`,
];
const commandArgs = [ "run" ];
if (options.containername) {
commandArgs.push(...["--name", options.containername]);
}
commandArgs.push(...["-v", "/var/run/docker.sock:/var/run/docker.sock:rw"]);
commandArgs.push(...["-v", `${lintPath}:/tmp/lint:rw`]);
if (options.fix === true) {
commandArgs.push(...["-e", "APPLY_FIXES=all"]);
}
Expand All @@ -134,9 +133,6 @@ ERROR: Docker engine has not been found on your system.
commandArgs.push(...["-e", envVarEqualsValue]);
}
}
if (commandArgs.containername) {
commandArgs.push(...["--name", commandArgs.containername]);
}
commandArgs.push(dockerImage);

// Call docker run
Expand Down

0 comments on commit 01273f5

Please sign in to comment.