mirror of
https://github.com/electron/electron.git
synced 2026-01-09 15:38:08 -05:00
build: fix invocation of cpplint on Windows (#26011)
This commit is contained in:
@@ -23,6 +23,8 @@ const IGNORELIST = new Set([
|
|||||||
['spec', 'ts-smoke', 'runner.js']
|
['spec', 'ts-smoke', 'runner.js']
|
||||||
].map(tokens => path.join(SOURCE_ROOT, ...tokens)));
|
].map(tokens => path.join(SOURCE_ROOT, ...tokens)));
|
||||||
|
|
||||||
|
const IS_WINDOWS = process.platform === 'win32';
|
||||||
|
|
||||||
function spawnAndCheckExitCode (cmd, args, opts) {
|
function spawnAndCheckExitCode (cmd, args, opts) {
|
||||||
opts = Object.assign({ stdio: 'inherit' }, opts);
|
opts = Object.assign({ stdio: 'inherit' }, opts);
|
||||||
const status = childProcess.spawnSync(cmd, args, opts).status;
|
const status = childProcess.spawnSync(cmd, args, opts).status;
|
||||||
@@ -30,7 +32,7 @@ function spawnAndCheckExitCode (cmd, args, opts) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function cpplint (args) {
|
function cpplint (args) {
|
||||||
const result = childProcess.spawnSync('cpplint.py', args, { encoding: 'utf8' });
|
const result = childProcess.spawnSync(IS_WINDOWS ? 'cpplint.bat' : 'cpplint.py', args, { encoding: 'utf8', shell: true });
|
||||||
// cpplint.py writes EVERYTHING to stderr, including status messages
|
// cpplint.py writes EVERYTHING to stderr, including status messages
|
||||||
if (result.stderr) {
|
if (result.stderr) {
|
||||||
for (const line of result.stderr.split(/[\r\n]+/)) {
|
for (const line of result.stderr.split(/[\r\n]+/)) {
|
||||||
@@ -39,8 +41,9 @@ function cpplint (args) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (result.status) {
|
if (result.status !== 0) {
|
||||||
process.exit(result.status);
|
if (result.error) console.error(result.error);
|
||||||
|
process.exit(result.status || 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user