Skip to content

Commit b9cd68f

Browse files
committed
fix(@angular/cli): exit with a non-zero error code when migration fails during ng update
In some cases, when a migration fails an error is not thrown, instead the `executeMigration` return a `false` value when resolved. With this change, we fix an issue were failed migrations resulted in the process of not terminating with a non-zero error code.
1 parent fe03267 commit b9cd68f

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

packages/angular/cli/commands/update-impl.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -482,8 +482,9 @@ export class UpdateCommand extends Command<UpdateCommandSchema> {
482482
}
483483
}
484484

485+
let result: boolean;
485486
if (typeof options.migrateOnly == 'string') {
486-
await this.executeMigration(
487+
result = await this.executeMigration(
487488
packageName,
488489
migrations,
489490
options.migrateOnly,
@@ -497,7 +498,7 @@ export class UpdateCommand extends Command<UpdateCommandSchema> {
497498
return 1;
498499
}
499500

500-
await this.executeMigrations(
501+
result = await this.executeMigrations(
501502
packageName,
502503
migrations,
503504
from,
@@ -506,7 +507,7 @@ export class UpdateCommand extends Command<UpdateCommandSchema> {
506507
);
507508
}
508509

509-
return 1;
510+
return result ? 0 : 1;
510511
}
511512

512513
const requests: {

0 commit comments

Comments
 (0)