@ubercode/dcmtk 0.10.0 → 0.11.0

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