| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent fc0fbf1 commit 9f23cb2
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -125,23 +125,28 @@ if (cluster.isMaster) { | |||
| 125 | 125 | sendWork(worker); | |
| 126 | 126 | }); | |
| 127 | 127 | ||
| 128 | - process.on('exit', function() { | ||
| 128 | + process.on('exit', function(code) { | ||
| 129 | 129 | if (showProgress) { | |
| 130 | 130 | curPath = 'Done'; | |
| 131 | 131 | printProgress(); | |
| 132 | 132 | outFn('\r\n'); | |
| 133 | 133 | } | |
| 134 | - process.exit(failures ? 1 : 0); | ||
| 134 | + if (code === 0) | ||
| 135 | + process.exit(failures ? 1 : 0); | ||
| 135 | 136 | }); | |
| 136 | 137 | ||
| 137 | 138 | for (i = 0; i < numCPUs; ++i) | |
| 138 | - cluster.fork().on('message', onWorkerMessage); | ||
| 139 | + cluster.fork().on('message', onWorkerMessage).on('exit', onWorkerExit); | ||
| 139 | 140 | ||
| 140 | 141 | function onWorkerMessage(results) { | |
| 141 | 142 | if (typeof results !== 'number') { | |
| 142 | 143 | // 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 { | ||
| 144 | 148 | failures += results.length; | |
| 149 | + } | ||
| 145 | 150 | outFn(formatter(results) + '\r\n'); | |
| 146 | 151 | printProgress(); | |
| 147 | 152 | } else { | |
@@ -151,6 +156,11 @@ if (cluster.isMaster) { | |||
| 151 | 156 | sendWork(this); | |
| 152 | 157 | } | |
| 153 | 158 | ||
| 159 | + function onWorkerExit(code, signal) { | ||
| 160 | + if (code !== 0 || signal) | ||
| 161 | + process.exit(2); | ||
| 162 | + } | ||
| 163 | + | ||
| 154 | 164 | function sendWork(worker) { | |
| 155 | 165 | if (!files || !files.length) { | |
| 156 | 166 | // We either just started or we have no more files to lint for the current | |
@@ -245,7 +255,7 @@ if (cluster.isMaster) { | |||
| 245 | 255 | } | |
| 246 | 256 | } | |
| 247 | 257 | } | |
| 248 | - process.send(results); | ||
| 258 | + process.send({ results: results, errorCount: report.errorCount }); | ||
| 249 | 259 | } else if (report.errorCount === 0) { | |
| 250 | 260 | // No errors, return number of successful lint operations | |
| 251 | 261 | process.send(files.length); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments