Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 9f23cb2

Browse filesBrowse files
mscdexFishrock123
authored andcommitted
tools: fix exit code when linting from CI
Before this, if there were lint errors reported by `make jslint-ci`, the process would still exit with an exit code of zero. This commit fixes that to align with `make jslint` (exit with non-zero on lint errors). PR-URL: #6412 Reviewed-By: Johan Bergström <bugs@bergstroem.nu> Reviewed-By: Phillip Johnsen <johphi@gmail.com> Reviewed-By: Santiago Gimeno <santiago.gimeno@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com>
1 parent fc0fbf1 commit 9f23cb2
Copy full SHA for 9f23cb2

File tree

Expand file treeCollapse file tree

1 file changed

+15
-5
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+15
-5
lines changed
Open diff view settings
Collapse file

‎tools/jslint.js‎

Copy file name to clipboardExpand all lines: tools/jslint.js
+15-5Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -125,23 +125,28 @@ if (cluster.isMaster) {
125125
sendWork(worker);
126126
});
127127

128-
process.on('exit', function() {
128+
process.on('exit', function(code) {
129129
if (showProgress) {
130130
curPath = 'Done';
131131
printProgress();
132132
outFn('\r\n');
133133
}
134-
process.exit(failures ? 1 : 0);
134+
if (code === 0)
135+
process.exit(failures ? 1 : 0);
135136
});
136137

137138
for (i = 0; i < numCPUs; ++i)
138-
cluster.fork().on('message', onWorkerMessage);
139+
cluster.fork().on('message', onWorkerMessage).on('exit', onWorkerExit);
139140

140141
function onWorkerMessage(results) {
141142
if (typeof results !== 'number') {
142143
// The worker sent us results that are not all successes
143-
if (!workerConfig.sendAll)
144+
if (workerConfig.sendAll) {
145+
failures += results.errorCount;
146+
results = results.results;
147+
} else {
144148
failures += results.length;
149+
}
145150
outFn(formatter(results) + '\r\n');
146151
printProgress();
147152
} else {
@@ -151,6 +156,11 @@ if (cluster.isMaster) {
151156
sendWork(this);
152157
}
153158

159+
function onWorkerExit(code, signal) {
160+
if (code !== 0 || signal)
161+
process.exit(2);
162+
}
163+
154164
function sendWork(worker) {
155165
if (!files || !files.length) {
156166
// We either just started or we have no more files to lint for the current
@@ -245,7 +255,7 @@ if (cluster.isMaster) {
245255
}
246256
}
247257
}
248-
process.send(results);
258+
process.send({ results: results, errorCount: report.errorCount });
249259
} else if (report.errorCount === 0) {
250260
// No errors, return number of successful lint operations
251261
process.send(files.length);

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.