@ubercode/dcmtk 0.10.0 → 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/servers.js CHANGED
@@ -2007,13 +2007,14 @@ async function execCommand(binary, args, options) {
2007
2007
  windowsHide: true,
2008
2008
  signal: options?.signal
2009
2009
  });
2010
- wireSpawnListeners(child, timeoutMs, resolve);
2010
+ wireSpawnListeners(binary, child, timeoutMs, resolve);
2011
2011
  });
2012
2012
  }
2013
- function wireSpawnListeners(child, timeoutMs, resolve) {
2013
+ function wireSpawnListeners(binary, child, timeoutMs, resolve) {
2014
2014
  let stdout = "";
2015
2015
  let stderr6 = "";
2016
2016
  let settled = false;
2017
+ const name = binary.split("/").pop() ?? binary;
2017
2018
  const settle = (result) => {
2018
2019
  if (settled) return;
2019
2020
  settled = true;
@@ -2022,25 +2023,25 @@ function wireSpawnListeners(child, timeoutMs, resolve) {
2022
2023
  };
2023
2024
  const timer = setTimeout(() => {
2024
2025
  if (child.pid !== void 0 && child.pid !== null) killTree(child.pid);
2025
- settle(err(new Error(`Process timed out after ${timeoutMs}ms`)));
2026
+ settle(err(new Error(`${name} timed out after ${timeoutMs}ms (pid: ${String(child.pid ?? "unknown")})`)));
2026
2027
  }, timeoutMs);
2027
2028
  child.stdout?.on("data", (chunk) => {
2028
2029
  stdout += String(chunk);
2029
2030
  if (stdout.length + stderr6.length > MAX_OUTPUT_BYTES) {
2030
2031
  if (child.pid !== void 0 && child.pid !== null) killTree(child.pid);
2031
- settle(err(new Error(`Process output exceeded ${MAX_OUTPUT_BYTES} bytes`)));
2032
+ settle(err(new Error(`${name} output exceeded ${MAX_OUTPUT_BYTES} bytes`)));
2032
2033
  }
2033
2034
  });
2034
2035
  child.stderr?.on("data", (chunk) => {
2035
2036
  stderr6 += String(chunk);
2036
2037
  if (stdout.length + stderr6.length > MAX_OUTPUT_BYTES) {
2037
2038
  if (child.pid !== void 0 && child.pid !== null) killTree(child.pid);
2038
- settle(err(new Error(`Process output exceeded ${MAX_OUTPUT_BYTES} bytes`)));
2039
+ settle(err(new Error(`${name} output exceeded ${MAX_OUTPUT_BYTES} bytes`)));
2039
2040
  }
2040
2041
  });
2041
2042
  child.on("error", (error) => {
2042
2043
  if (child.pid !== void 0 && child.pid !== null) killTree(child.pid);
2043
- settle(err(new Error(`Process error: ${error.message}`)));
2044
+ settle(err(new Error(`${name} error: ${error.message}`)));
2044
2045
  });
2045
2046
  child.on("close", (code) => {
2046
2047
  settle(ok({ stdout, stderr: stderr6, exitCode: code ?? 1 }));
@@ -2055,7 +2056,7 @@ async function spawnCommand(binary, args, options) {
2055
2056
  windowsHide: true,
2056
2057
  signal: options?.signal
2057
2058
  });
2058
- wireSpawnListeners(child, timeoutMs, resolve);
2059
+ wireSpawnListeners(binary, child, timeoutMs, resolve);
2059
2060
  });
2060
2061
  }
2061
2062
  var PN_REPS = ["Alphabetic", "Ideographic", "Phonetic"];