From ec47c72bb194db64c1cbf043775f97f3ee505a6a Mon Sep 17 00:00:00 2001 From: Jon Edvald Date: Thu, 19 Apr 2018 14:34:57 +0200 Subject: [PATCH] fix: issue where module scanning would hang with empty projects --- src/garden.ts | 4 ++++ src/util.ts | 1 + 2 files changed, 5 insertions(+) diff --git a/src/garden.ts b/src/garden.ts index 9e81f6779e..1fff6f005c 100644 --- a/src/garden.ts +++ b/src/garden.ts @@ -507,6 +507,10 @@ export class Garden { const modulePaths: string[] = [] for await (const item of scanDirectory(this.projectRoot, scanOpts)) { + if (!item) { + continue + } + const parsedPath = parse(item.path) if (parsedPath.base !== MODULE_CONFIG_FILENAME) { diff --git a/src/util.ts b/src/util.ts index 6062480d21..7479c48f55 100644 --- a/src/util.ts +++ b/src/util.ts @@ -119,6 +119,7 @@ export async function* scanDirectory(path: string, opts?: klaw.Options): AsyncIt }) .on("end", () => { done = true + resolver() }) // a nice little trick to turn the stream into an async generator