font should return a promise with null here, instead of just null

This commit is contained in:
Sparticuz 2022-12-30 11:28:52 -05:00
parent 9578aa0154
commit 03ec742402
1 changed files with 5 additions and 3 deletions

View File

@ -52,11 +52,13 @@ if ( process.env.AWS_EXECUTION_ENV !== undefined && /^AWS_Lambda_nodejs(?:14|16|
class Chromium { class Chromium {
/** /**
* Downloads or symlinks a custom font and returns its basename, patching the environment so that Chromium can find it. * Downloads or symlinks a custom font and returns its basename, patching the environment so that Chromium can find it.
* If not running on AWS Lambda nor Google Cloud Functions, `null` is returned instead. * If headless is not true, `null` is returned instead.
*/ */
static font(input: string): Promise<string> { static font(input: string): Promise<string | null> {
if (Chromium.headless !== true) { if (Chromium.headless !== true) {
return null; return new Promise((resolve) => {
return resolve(null);
});
} }
if (process.env.HOME === undefined) { if (process.env.HOME === undefined) {