fix(gpt-runner-cli): fix cli can not auto open in browser

This commit is contained in:
JinmingYang
2023-08-15 22:45:05 +08:00
parent ff75480d99
commit 3944dda6b8

View File

@@ -56,8 +56,10 @@ export async function startCli(cwd = PathUtils.resolve(process.cwd()), argv = pr
autoFreePort: true,
})
let startServerPromise: Promise<any> | 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)