build: fix crash when validating commit messages (#41949)

Fixes a crash when running the `ValidateFileModule`.

PR Close #41949
This commit is contained in:
Zach Arend 2021-05-04 16:25:39 -07:00 committed by Misko Hevery
parent 6eafaa7b5e
commit fdf2e02bff
2 changed files with 7 additions and 1 deletions

View File

@ -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.`);

View File

@ -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.`);