@@ -10,12 +10,20 @@ import 'symbol-observable';
10
10
// symbol polyfill must go first
11
11
import { promises as fs } from 'fs' ;
12
12
import * as path from 'path' ;
13
- import { SemVer } from 'semver' ;
13
+ import { SemVer , major } from 'semver' ;
14
14
import { colors } from '../src/utilities/color' ;
15
15
import { isWarningEnabled } from '../src/utilities/config' ;
16
16
import { disableVersionCheck } from '../src/utilities/environment-options' ;
17
17
import { VERSION } from '../src/utilities/version' ;
18
18
19
+ /**
20
+ * Angular CLI versions prior to v14 may not exit correctly if not forcibly exited
21
+ * via `process.exit()`. When bootstrapping, `forceExit` will be set to `true`
22
+ * if the local CLI version is less than v14 to prevent the CLI from hanging on
23
+ * exit in those cases.
24
+ */
25
+ let forceExit = false ;
26
+
19
27
( async ( ) => {
20
28
/**
21
29
* Disable Browserslist old data warning as otherwise with every release we'd need to update this dependency
@@ -57,6 +65,11 @@ import { VERSION } from '../src/utilities/version';
57
65
}
58
66
}
59
67
68
+ // Ensure older versions of the CLI fully exit
69
+ if ( major ( localVersion ) < 14 ) {
70
+ forceExit = true ;
71
+ }
72
+
60
73
let isGlobalGreater = false ;
61
74
try {
62
75
isGlobalGreater = ! ! localVersion && globalVersion . compare ( localVersion ) > 0 ;
@@ -107,6 +120,9 @@ import { VERSION } from '../src/utilities/version';
107
120
} ) ;
108
121
} )
109
122
. then ( ( exitCode : number ) => {
123
+ if ( forceExit ) {
124
+ process . exit ( exitCode ) ;
125
+ }
110
126
process . exitCode = exitCode ;
111
127
} )
112
128
. catch ( ( err : Error ) => {
0 commit comments