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)