Skip to content

Commit 4705013

Browse files
committed
In case of ng completion, display the warning text to stderr and exit with return code 1.
1 parent 4434e5f commit 4705013

File tree

1 file changed

+5
-5
lines changed
  • packages/@angular/cli/bin

1 file changed

+5
-5
lines changed

packages/@angular/cli/bin/ng

+5-5
Original file line numberDiff line numberDiff line change
@@ -155,20 +155,20 @@ resolve('@angular/cli', { basedir: process.cwd() },
155155
}
156156

157157
if (shouldWarn && CliConfig.fromGlobal().get('warnings.versionMismatch')) {
158-
let warning = stripIndents`
158+
let warning = yellow(stripIndents`
159159
Your global Angular CLI version (${globalVersion}) is greater than your local
160160
version (${localVersion}). The local Angular CLI version is used.
161161
162162
To disable this warning use "ng set --global warnings.versionMismatch=false".
163-
`;
163+
`);
164164
// Don't show warning colorised on `ng completion`
165165
if (process.argv[2] !== 'completion') {
166166
// eslint-disable no-console
167-
console.log(yellow(warning));
167+
console.log(warning);
168168
} else {
169-
warning = warning.replace(/^/gm, '# ');
170169
// eslint-disable no-console
171-
console.log(warning);
170+
console.error(warning);
171+
process.exit(1);
172172
}
173173
}
174174

0 commit comments

Comments
 (0)