Skip to content

Commit

Permalink
fix(@angular/cli): process keeps running when analytics are enabled
Browse files Browse the repository at this point in the history
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
  • Loading branch information
alan-agius4 authored and angular-robot[bot] committed Apr 18, 2023
1 parent 758b069 commit c0a0f72
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/angular/cli/src/analytics/analytics-collector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,9 @@ export class AnalyticsCollector {
},
},
(response) => {
// The below is needed as otherwise the response will never close which will cause the CLI not to terminate.
response.on('data', () => {});

if (response.statusCode !== 200 && response.statusCode !== 204) {
reject(
new Error(`Analytics reporting failed with status code: ${response.statusCode}.`),
Expand Down

0 comments on commit c0a0f72

Please sign in to comment.