Commit a4860d5
committed
fix(@angular/build): prevent build process hang on unhandled error (#33715)
When an unhandled exception is thrown during a build (such as IndexHtmlGenerator.readIndex throwing when an index HTML file is missing or unreadable), executeBuild() previously re-threw without calling .dispose() on executionResult or angularCompilationContext. Consequently, open ESBuild child processes, TypeScript compiler worker threads, and SQLite database connections prevented the Node.js process from exiting.
This commit addresses the issue by:
1. Wrapping the entire body of executeBuild() in a try...catch block and instantiating executionResult immediately after bundlerContexts is created, so any thrown error reliably disposes all worker pools and AST caches before re-throwing.
2. Closing the SQLite cache store (angular-i18n.db) in I18nInliner.close() alongside worker pool destruction.
3. Ensuring Sass workers are shut down in build-action even if an initial --watch build throws an exception.
Closes #33716
PR Close #337151 parent 4fd8140 commit a4860d5
6 files changed
Lines changed: 222 additions & 212 deletions
File tree
- packages/angular/build/src
- builders/application
- tests/options
- tools/esbuild
- angular
Lines changed: 3 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
84 | | - | |
| 84 | + | |
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | 89 | | |
90 | 90 | | |
91 | 91 | | |
92 | | - | |
93 | | - | |
| 92 | + | |
| 93 | + | |
94 | 94 | | |
95 | 95 | | |
96 | 96 | | |
| |||
0 commit comments