From 3944dda6b8a2e88ad7c6e4caeae670a8ca560d48 Mon Sep 17 00:00:00 2001 From: JinmingYang <2214962083@qq.com> Date: Tue, 15 Aug 2023 22:45:05 +0800 Subject: [PATCH] fix(gpt-runner-cli): fix cli can not auto open in browser --- packages/gpt-runner-cli/src/cli-start.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/gpt-runner-cli/src/cli-start.ts b/packages/gpt-runner-cli/src/cli-start.ts index 549509fa..c88c8a24 100644 --- a/packages/gpt-runner-cli/src/cli-start.ts +++ b/packages/gpt-runner-cli/src/cli-start.ts @@ -56,8 +56,10 @@ export async function startCli(cwd = PathUtils.resolve(process.cwd()), argv = pr autoFreePort: true, }) + let startServerPromise: Promise | undefined + try { - await execa('node', [startServerJsPath, '--port', String(finalPort)], { + startServerPromise = execa('node', [startServerJsPath, '--port', String(finalPort)], { env: { ...process.env, ...getRunServerEnv(), @@ -114,6 +116,8 @@ export async function startCli(cwd = PathUtils.resolve(process.cwd()), argv = pr }) afterServerStartSuccess() + + await startServerPromise } catch (error) { consola.error(error)