@ubercode/dcmtk 0.9.4 → 0.10.1

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.
package/dist/dicom.cjs CHANGED
@@ -30384,13 +30384,14 @@ async function execCommand(binary, args, options) {
30384
30384
  windowsHide: true,
30385
30385
  signal: options?.signal
30386
30386
  });
30387
- wireSpawnListeners(child, timeoutMs, resolve);
30387
+ wireSpawnListeners(binary, child, timeoutMs, resolve);
30388
30388
  });
30389
30389
  }
30390
- function wireSpawnListeners(child, timeoutMs, resolve) {
30390
+ function wireSpawnListeners(binary, child, timeoutMs, resolve) {
30391
30391
  let stdout = "";
30392
30392
  let stderr4 = "";
30393
30393
  let settled = false;
30394
+ const name = binary.split("/").pop() ?? binary;
30394
30395
  const settle = (result) => {
30395
30396
  if (settled) return;
30396
30397
  settled = true;
@@ -30399,25 +30400,25 @@ function wireSpawnListeners(child, timeoutMs, resolve) {
30399
30400
  };
30400
30401
  const timer = setTimeout(() => {
30401
30402
  if (child.pid !== void 0 && child.pid !== null) killTree(child.pid);
30402
- settle(err(new Error(`Process timed out after ${timeoutMs}ms`)));
30403
+ settle(err(new Error(`${name} timed out after ${timeoutMs}ms (pid: ${String(child.pid ?? "unknown")})`)));
30403
30404
  }, timeoutMs);
30404
30405
  child.stdout?.on("data", (chunk) => {
30405
30406
  stdout += String(chunk);
30406
30407
  if (stdout.length + stderr4.length > MAX_OUTPUT_BYTES) {
30407
30408
  if (child.pid !== void 0 && child.pid !== null) killTree(child.pid);
30408
- settle(err(new Error(`Process output exceeded ${MAX_OUTPUT_BYTES} bytes`)));
30409
+ settle(err(new Error(`${name} output exceeded ${MAX_OUTPUT_BYTES} bytes`)));
30409
30410
  }
30410
30411
  });
30411
30412
  child.stderr?.on("data", (chunk) => {
30412
30413
  stderr4 += String(chunk);
30413
30414
  if (stdout.length + stderr4.length > MAX_OUTPUT_BYTES) {
30414
30415
  if (child.pid !== void 0 && child.pid !== null) killTree(child.pid);
30415
- settle(err(new Error(`Process output exceeded ${MAX_OUTPUT_BYTES} bytes`)));
30416
+ settle(err(new Error(`${name} output exceeded ${MAX_OUTPUT_BYTES} bytes`)));
30416
30417
  }
30417
30418
  });
30418
30419
  child.on("error", (error) => {
30419
30420
  if (child.pid !== void 0 && child.pid !== null) killTree(child.pid);
30420
- settle(err(new Error(`Process error: ${error.message}`)));
30421
+ settle(err(new Error(`${name} error: ${error.message}`)));
30421
30422
  });
30422
30423
  child.on("close", (code) => {
30423
30424
  settle(ok({ stdout, stderr: stderr4, exitCode: code ?? 1 }));
@@ -30432,7 +30433,7 @@ async function spawnCommand(binary, args, options) {
30432
30433
  windowsHide: true,
30433
30434
  signal: options?.signal
30434
30435
  });
30435
- wireSpawnListeners(child, timeoutMs, resolve);
30436
+ wireSpawnListeners(binary, child, timeoutMs, resolve);
30436
30437
  });
30437
30438
  }
30438
30439
  var cachedPath;