@poe-platform/safe-bash 0.1.63 → 0.1.65

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.
@@ -10168,6 +10168,15 @@ var Capture = class {
10168
10168
  }
10169
10169
  return bytes2;
10170
10170
  }
10171
+ takeBytes() {
10172
+ const chunk = this.chunks.length === 1 ? this.chunks[0] : void 0;
10173
+ const bytes2 = chunk && chunk.byteLength === chunk.buffer.byteLength ? chunk : this.bytes();
10174
+ this.chunks.length = 0;
10175
+ this.length = 0;
10176
+ this.#tail = void 0;
10177
+ this.#tailLength = 0;
10178
+ return bytes2;
10179
+ }
10171
10180
  };
10172
10181
  var typedSavedVariables = /* @__PURE__ */ new WeakMap();
10173
10182
  var valueScope = /* @__PURE__ */ Symbol("shell value allocation scope");
@@ -15633,8 +15642,8 @@ shell: -c: line ${line}: \`${source.split("\n")[line - 1] ?? ""}'
15633
15642
  });
15634
15643
  else await stdin?.close();
15635
15644
  }
15636
- const stdoutBytes = stdout.bytes();
15637
- const stderrBytes = stderr.bytes();
15645
+ const stdoutBytes = stdout.takeBytes();
15646
+ const stderrBytes = stderr.takeBytes();
15638
15647
  return {
15639
15648
  stdout: new TextDecoder("utf-8", { ignoreBOM: true }).decode(stdoutBytes),
15640
15649
  stderr: new TextDecoder("utf-8", { ignoreBOM: true }).decode(stderrBytes),
@@ -16445,6 +16454,7 @@ var Budget3 = class {
16445
16454
  maxBufferBytes;
16446
16455
  remaining;
16447
16456
  checkpoints = 0;
16457
+ lastYield = monotonicNow();
16448
16458
  step(count2 = 1) {
16449
16459
  this.context.signal.throwIfAborted();
16450
16460
  this.remaining -= count2;
@@ -16455,7 +16465,11 @@ var Budget3 = class {
16455
16465
  return text;
16456
16466
  }
16457
16467
  async checkpoint() {
16458
- if (++this.checkpoints % 256 === 0) await yieldTurn(this.context.signal);
16468
+ this.context.signal.throwIfAborted();
16469
+ if (++this.checkpoints % 256 === 0 || monotonicNow() - this.lastYield >= 25) {
16470
+ await yieldTurn(this.context.signal);
16471
+ this.lastYield = monotonicNow();
16472
+ }
16459
16473
  this.context.signal.throwIfAborted();
16460
16474
  }
16461
16475
  };