Skip to content

Commit f4a6dac

Browse files
alan-agius4clydin
authored andcommitted
fix(@angular/cli): process keeps running when analytics are enabled
In newer Node.js versions ng commands do not terminate properly when analytics are enabled. This is because the request is never closed unless a `data` event listener is attached. Closes #25034 and closes #25008 (cherry picked from commit c0a0f72)
1 parent d9e9f74 commit f4a6dac

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

packages/angular/cli/src/analytics/analytics-collector.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -182,6 +182,9 @@ export class AnalyticsCollector {
182182
},
183183
},
184184
(response) => {
185+
// The below is needed as otherwise the response will never close which will cause the CLI not to terminate.
186+
response.on('data', () => {});
187+
185188
if (response.statusCode !== 200 && response.statusCode !== 204) {
186189
reject(
187190
new Error(`Analytics reporting failed with status code: ${response.statusCode}.`),

0 commit comments

Comments
 (0)