From 09fcc460794d515c48c38ccb47a936d58a2582b3 Mon Sep 17 00:00:00 2001 From: YongGit <1013588891@qq.com> Date: Mon, 24 Oct 2022 16:43:27 +0800 Subject: [PATCH] fix(build): explicitly exit process after build to prevent hangup (#1530) Co-authored-by: Divyansh Singh <40380293+brc-dd@users.noreply.github.com> --- .gitignore | 1 + src/node/cli.ts | 12 ++++++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/.gitignore b/.gitignore index c7291401..b0bd43cf 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ pnpm-global TODOs.md .temp *.tgz +examples-temp diff --git a/src/node/cli.ts b/src/node/cli.ts index 0d992fab..1d95c3e7 100644 --- a/src/node/cli.ts +++ b/src/node/cli.ts @@ -28,10 +28,14 @@ if (!command || command === 'dev') { process.exit(1) }) } else if (command === 'build') { - build(root, argv).catch((err) => { - console.error(c.red(`build error:\n`), err) - process.exit(1) - }) + build(root, argv) + .then(() => { + process.exit() + }) + .catch((err) => { + console.error(c.red(`build error:\n`), err) + process.exit(1) + }) } else if (command === 'serve') { serve(argv).catch((err) => { console.error(c.red(`failed to start server. error:\n`), err)