Skip to content

Commit

Permalink
fix(@angular/cli): exit with a non-zero error code when migration fai…
Browse files Browse the repository at this point in the history
…ls 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.

(cherry picked from commit b9cd68f)
  • Loading branch information
alan-agius4 committed Nov 24, 2021
1 parent 4d01d4f commit ded7b5c
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions packages/angular/cli/commands/update-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -482,8 +482,9 @@ export class UpdateCommand extends Command<UpdateCommandSchema> {
}
}

let result: boolean;
if (typeof options.migrateOnly == 'string') {
await this.executeMigration(
result = await this.executeMigration(
packageName,
migrations,
options.migrateOnly,
Expand All @@ -497,7 +498,7 @@ export class UpdateCommand extends Command<UpdateCommandSchema> {
return 1;
}

await this.executeMigrations(
result = await this.executeMigrations(
packageName,
migrations,
from,
Expand All @@ -506,7 +507,7 @@ export class UpdateCommand extends Command<UpdateCommandSchema> {
);
}

return 1;
return result ? 0 : 1;
}

const requests: {
Expand Down

0 comments on commit ded7b5c

Please sign in to comment.