chatccc 0.2.310 → 0.2.311
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -203,8 +203,13 @@ export class CodexAppServerManager {
|
|
|
203
203
|
return Promise.resolve(this.port);
|
|
204
204
|
if (this.starting)
|
|
205
205
|
return this.starting;
|
|
206
|
-
|
|
207
|
-
|
|
206
|
+
const starting = this.start(command);
|
|
207
|
+
this.starting = starting;
|
|
208
|
+
starting.catch(() => {
|
|
209
|
+
if (this.starting === starting)
|
|
210
|
+
this.starting = null;
|
|
211
|
+
});
|
|
212
|
+
return starting;
|
|
208
213
|
}
|
|
209
214
|
async start(command) {
|
|
210
215
|
const port = await pickFreePort();
|
|
@@ -226,6 +231,8 @@ export class CodexAppServerManager {
|
|
|
226
231
|
if (this.proc === proc) {
|
|
227
232
|
this.proc = null;
|
|
228
233
|
this.port = null;
|
|
234
|
+
// starting 仍持有已 resolve 的旧端口,不清掉会让后续连接永远打到死端口
|
|
235
|
+
this.starting = null;
|
|
229
236
|
}
|
|
230
237
|
if (code !== 0 && stderr.trim()) {
|
|
231
238
|
console.error(`[Codex app-server] 退出码=${code}: ${stderr.trim().slice(0, 2000)}`);
|