Skip to content

Commit

Permalink
build: fix crash when validating commit messages (#41949)
Browse files Browse the repository at this point in the history
Fixes a crash when running the `ValidateFileModule`.

PR Close #41949
  • Loading branch information
zarend authored and mhevery committed May 5, 2021
1 parent 6eafaa7 commit fdf2e02
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
5 changes: 4 additions & 1 deletion dev-infra/commit-message/validate-file/cli.ts
Expand Up @@ -31,7 +31,10 @@ function builder(yargs: Argv) {
type: 'string',
conflicts: ['file'],
description: 'The key of the environment variable for the path of the commit message file.',
coerce: (arg: string) => {
coerce: (arg: string|undefined) => {
if (arg === undefined) {
return arg;
}
const file = process.env[arg];
if (!file) {
throw new Error(`Provided environment variable "${arg}" was not found.`);
Expand Down
3 changes: 3 additions & 0 deletions dev-infra/ng-dev.js
Expand Up @@ -2113,6 +2113,9 @@ function builder$2(yargs) {
conflicts: ['file'],
description: 'The key of the environment variable for the path of the commit message file.',
coerce: (arg) => {
if (arg === undefined) {
return arg;
}
const file = process.env[arg];
if (!file) {
throw new Error(`Provided environment variable "${arg}" was not found.`);
Expand Down

0 comments on commit fdf2e02

Please sign in to comment.