@xdevops/issue-auto-finish 1.0.79 → 1.0.80

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.
@@ -3171,14 +3171,13 @@ var PortAllocator = class {
3171
3171
  import { spawn } from "child_process";
3172
3172
  import fs10 from "fs";
3173
3173
  import path11 from "path";
3174
- import https from "https";
3175
- import http from "http";
3174
+ import net2 from "net";
3176
3175
  var logger12 = logger.child("DevServerManager");
3177
3176
  var DEFAULT_OPTIONS2 = {
3178
3177
  healthCheckTimeoutMs: 12e4,
3179
3178
  healthCheckIntervalMs: 3e3
3180
3179
  };
3181
- function waitForPort(port, useTls, timeoutMs, intervalMs) {
3180
+ function waitForPort(port, timeoutMs, intervalMs) {
3182
3181
  return new Promise((resolve, reject) => {
3183
3182
  const deadline = Date.now() + timeoutMs;
3184
3183
  const check = () => {
@@ -3186,24 +3185,18 @@ function waitForPort(port, useTls, timeoutMs, intervalMs) {
3186
3185
  reject(new Error(`Port ${port} not ready after ${timeoutMs}ms`));
3187
3186
  return;
3188
3187
  }
3189
- const req = useTls ? https.get(
3190
- { hostname: "127.0.0.1", port, path: "/", rejectUnauthorized: false, timeout: 5e3 },
3191
- (res) => {
3192
- res.resume();
3193
- resolve();
3194
- }
3195
- ) : http.get(
3196
- { hostname: "127.0.0.1", port, path: "/", timeout: 5e3 },
3197
- (res) => {
3198
- res.resume();
3199
- resolve();
3200
- }
3201
- );
3202
- req.on("error", () => {
3188
+ const socket = net2.createConnection({ host: "127.0.0.1", port });
3189
+ socket.setTimeout(5e3);
3190
+ socket.on("connect", () => {
3191
+ socket.destroy();
3192
+ resolve();
3193
+ });
3194
+ socket.on("error", () => {
3195
+ socket.destroy();
3203
3196
  setTimeout(check, intervalMs);
3204
3197
  });
3205
- req.on("timeout", () => {
3206
- req.destroy();
3198
+ socket.on("timeout", () => {
3199
+ socket.destroy();
3207
3200
  setTimeout(check, intervalMs);
3208
3201
  });
3209
3202
  };
@@ -3248,8 +3241,9 @@ var DevServerManager = class {
3248
3241
  cwd: wtCtx.workDir,
3249
3242
  env: backendEnv,
3250
3243
  stdio: ["ignore", "pipe", "pipe"],
3251
- detached: false
3244
+ detached: true
3252
3245
  });
3246
+ backend.unref();
3253
3247
  backend.stdout?.on("data", (data) => {
3254
3248
  backendLog.write(tsLine("stdout", data));
3255
3249
  });
@@ -3271,8 +3265,9 @@ var DevServerManager = class {
3271
3265
  cwd: frontendDir,
3272
3266
  env: frontendEnv,
3273
3267
  stdio: ["ignore", "pipe", "pipe"],
3274
- detached: false
3268
+ detached: true
3275
3269
  });
3270
+ frontend.unref();
3276
3271
  frontend.stdout?.on("data", (data) => {
3277
3272
  frontendLog.write(tsLine("stdout", data));
3278
3273
  });
@@ -3297,13 +3292,11 @@ var DevServerManager = class {
3297
3292
  await Promise.all([
3298
3293
  waitForPort(
3299
3294
  ports.backendPort,
3300
- false,
3301
3295
  this.options.healthCheckTimeoutMs,
3302
3296
  this.options.healthCheckIntervalMs
3303
3297
  ),
3304
3298
  waitForPort(
3305
3299
  ports.frontendPort,
3306
- true,
3307
3300
  this.options.healthCheckTimeoutMs,
3308
3301
  this.options.healthCheckIntervalMs
3309
3302
  )
@@ -3349,11 +3342,21 @@ var DevServerManager = class {
3349
3342
  function killProcess(proc, label) {
3350
3343
  try {
3351
3344
  if (proc.killed || proc.exitCode !== null) return;
3352
- proc.kill("SIGTERM");
3345
+ const pid = proc.pid;
3346
+ if (!pid) return;
3347
+ try {
3348
+ process.kill(-pid, "SIGTERM");
3349
+ } catch {
3350
+ proc.kill("SIGTERM");
3351
+ }
3353
3352
  setTimeout(() => {
3354
3353
  if (!proc.killed && proc.exitCode === null) {
3355
3354
  logger12.warn(`Force killing ${label}`);
3356
- proc.kill("SIGKILL");
3355
+ try {
3356
+ process.kill(-pid, "SIGKILL");
3357
+ } catch {
3358
+ proc.kill("SIGKILL");
3359
+ }
3357
3360
  }
3358
3361
  }, 5e3);
3359
3362
  } catch (err) {
@@ -4727,6 +4730,7 @@ E2E \u6D4B\u8BD5\u5C06\u5C1D\u8BD5\u4F7F\u7528 config.json \u4E2D\u7684\u9ED8\u8
4727
4730
  if (!fsSync.existsSync(wtCtx.workDir)) {
4728
4731
  throw new InvalidStateError(record.state, "Worktree no longer exists");
4729
4732
  }
4733
+ this.stopPreviewServers(issueIid);
4730
4734
  const ports = await this.portAllocator.allocate(issueIid);
4731
4735
  wtCtx.ports = ports;
4732
4736
  try {
@@ -5141,4 +5145,4 @@ export {
5141
5145
  PipelineOrchestrator,
5142
5146
  BrainstormService
5143
5147
  };
5144
- //# sourceMappingURL=chunk-UWLXEZSL.js.map
5148
+ //# sourceMappingURL=chunk-CUZCZUMA.js.map