Skip to content

Commit e957998

Browse files
Don't add literal double quote characters to filenames (#1984)
* Remove unnecessary spawnSync options. The detached option defaults to false, and the cwd option defaults to the current working directory, so there is no need to specify them. * Don't retrieve spawnRes properties individually. This isn't necessary and gives the misleading impression that stdout and stderr may contain something. They cannot since the Docker image is run with stdio: "inherit", meaning the stdio and stderr streams are passed through to/from the mega-linter-runner process and hence aren't captured. * Don't add literal " character to filenames (#1942) The extra quotes caused MegaLinter to fail to find the first and last files in the list on non-Windows platforms, because the first has a literal double quote character prepended to it, and the last has one appended to it. Stop passing Windows arguments verbatim to eliminate the need for the quotes on Windows. Co-authored-by: nvuillam <[email protected]>
1 parent b8777b6 commit e957998

File tree

2 files changed

+3
-9
lines changed

2 files changed

+3
-9
lines changed

Diff for: CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
99
Note: Can be used with `oxsecurity/megalinter@beta` in your GitHub Action mega-linter.yml file, or with `oxsecurity/megalinter:beta` docker image
1010

1111
- New [cupcake flavor](https://oxsecurity.github.io/megalinter/beta/flavors/cupcake/#readme) with 78 instead of 108 linters
12+
- Don't add literal double quote character to filenames in mega-linter-runner ([#1942](https://github.com/oxsecurity/megalinter/issues/1942)).
1213
- Remove default npm-groovy-lint extra arguments ([#1872](https://github.com/oxsecurity/megalinter/issues/1872))
1314

1415
- Linter versions upgrades

Diff for: mega-linter-runner/lib/runner.js

+2-9
Original file line numberDiff line numberDiff line change
@@ -151,20 +151,17 @@ ERROR: Docker engine has not been found on your system.
151151
if ((options._ || []).length > 0) {
152152
commandArgs.push(
153153
...["-e"],
154-
`MEGALINTER_FILES_TO_LINT="${options._.join(",")}"`
154+
`MEGALINTER_FILES_TO_LINT=${options._.join(",")}`
155155
);
156156
}
157157
commandArgs.push(dockerImage);
158158

159159
// Call docker run
160160
console.log(`Command: docker ${commandArgs.join(" ")}`);
161161
const spawnOptions = {
162-
detached: false,
163-
cwd: process.cwd(),
164162
env: Object.assign({}, process.env),
165163
stdio: "inherit",
166164
windowsHide: true,
167-
windowsVerbatimArguments: true,
168165
};
169166
const spawnRes = spawnSync("docker", commandArgs, spawnOptions);
170167
// Output json if requested
@@ -179,11 +176,7 @@ ERROR: Docker engine has not been found on your system.
179176
console.log(JSON.stringify(JSON.parse(jsonRaw)));
180177
}
181178
}
182-
return {
183-
status: spawnRes.status,
184-
stdout: spawnRes.stdout,
185-
stderr: spawnRes.stderr,
186-
};
179+
return spawnRes;
187180
}
188181

189182
isv4(release) {

0 commit comments

Comments
 (0)