@ai-development-environment/control-agent 0.0.35 → 0.0.37

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.
@@ -3328,12 +3328,23 @@ function parsePlist(xml) {
3328
3328
  import { spawn as spawn2 } from "node:child_process";
3329
3329
  var MAX_OUTPUT_BYTES = 2 * 1024 * 1024;
3330
3330
  function captureCommand(options) {
3331
+ if (options.signal.aborted || options.timeoutMs <= 0) {
3332
+ return Promise.resolve({
3333
+ exitCode: null,
3334
+ signal: null,
3335
+ timedOut: !options.signal.aborted,
3336
+ cancelled: options.signal.aborted,
3337
+ stdout: "",
3338
+ stderr: ""
3339
+ });
3340
+ }
3331
3341
  return new Promise((resolve6, reject) => {
3332
3342
  let stdout = "";
3333
3343
  let stderr = "";
3334
3344
  let timedOut = false;
3335
3345
  let cancelled = false;
3336
3346
  let settled = false;
3347
+ let killTimer = null;
3337
3348
  const child = spawn2(options.command, options.args, {
3338
3349
  shell: false,
3339
3350
  stdio: [
@@ -3354,8 +3365,10 @@ function captureCommand(options) {
3354
3365
  const terminate = () => {
3355
3366
  if (child.exitCode !== null || child.killed) return;
3356
3367
  child.kill("SIGTERM");
3357
- const timer = setTimeout(() => child.kill("SIGKILL"), 5e3);
3358
- timer.unref();
3368
+ killTimer = setTimeout(() => {
3369
+ if (child.exitCode === null) child.kill("SIGKILL");
3370
+ }, 5e3);
3371
+ killTimer.unref();
3359
3372
  };
3360
3373
  const timeout = setTimeout(() => {
3361
3374
  timedOut = true;
@@ -3372,6 +3385,7 @@ function captureCommand(options) {
3372
3385
  if (settled) return;
3373
3386
  settled = true;
3374
3387
  clearTimeout(timeout);
3388
+ if (killTimer) clearTimeout(killTimer);
3375
3389
  options.signal.removeEventListener("abort", abort);
3376
3390
  reject(error);
3377
3391
  });
@@ -3379,6 +3393,7 @@ function captureCommand(options) {
3379
3393
  if (settled) return;
3380
3394
  settled = true;
3381
3395
  clearTimeout(timeout);
3396
+ if (killTimer) clearTimeout(killTimer);
3382
3397
  options.signal.removeEventListener("abort", abort);
3383
3398
  resolve6({
3384
3399
  exitCode,
@@ -3812,6 +3827,7 @@ var successfulProcess = {
3812
3827
  };
3813
3828
  var scanSigningAssets = async (payload, timeoutMs, signal) => {
3814
3829
  signingScanPayload(payload);
3830
+ signal.throwIfAborted();
3815
3831
  const [decoded, certificates] = await Promise.all([
3816
3832
  decodedProfiles(timeoutMs, signal, true),
3817
3833
  readCertificates(timeoutMs, signal, true)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-development-environment/control-agent",
3
- "version": "0.0.35",
3
+ "version": "0.0.37",
4
4
  "description": "Control agent for the AI Development Environment",
5
5
  "license": "MIT",
6
6
  "repository": {