@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.cjs CHANGED
@@ -2032,13 +2032,14 @@ async function execCommand(binary, args, options) {
2032
2032
  windowsHide: true,
2033
2033
  signal: options?.signal
2034
2034
  });
2035
- wireSpawnListeners(child, timeoutMs, resolve);
2035
+ wireSpawnListeners(binary, child, timeoutMs, resolve);
2036
2036
  });
2037
2037
  }
2038
- function wireSpawnListeners(child, timeoutMs, resolve) {
2038
+ function wireSpawnListeners(binary, child, timeoutMs, resolve) {
2039
2039
  let stdout = "";
2040
2040
  let stderr6 = "";
2041
2041
  let settled = false;
2042
+ const name = binary.split("/").pop() ?? binary;
2042
2043
  const settle = (result) => {
2043
2044
  if (settled) return;
2044
2045
  settled = true;
@@ -2047,25 +2048,25 @@ function wireSpawnListeners(child, timeoutMs, resolve) {
2047
2048
  };
2048
2049
  const timer = setTimeout(() => {
2049
2050
  if (child.pid !== void 0 && child.pid !== null) killTree(child.pid);
2050
- settle(err(new Error(`Process timed out after ${timeoutMs}ms`)));
2051
+ settle(err(new Error(`${name} timed out after ${timeoutMs}ms (pid: ${String(child.pid ?? "unknown")})`)));
2051
2052
  }, timeoutMs);
2052
2053
  child.stdout?.on("data", (chunk) => {
2053
2054
  stdout += String(chunk);
2054
2055
  if (stdout.length + stderr6.length > MAX_OUTPUT_BYTES) {
2055
2056
  if (child.pid !== void 0 && child.pid !== null) killTree(child.pid);
2056
- settle(err(new Error(`Process output exceeded ${MAX_OUTPUT_BYTES} bytes`)));
2057
+ settle(err(new Error(`${name} output exceeded ${MAX_OUTPUT_BYTES} bytes`)));
2057
2058
  }
2058
2059
  });
2059
2060
  child.stderr?.on("data", (chunk) => {
2060
2061
  stderr6 += String(chunk);
2061
2062
  if (stdout.length + stderr6.length > MAX_OUTPUT_BYTES) {
2062
2063
  if (child.pid !== void 0 && child.pid !== null) killTree(child.pid);
2063
- settle(err(new Error(`Process output exceeded ${MAX_OUTPUT_BYTES} bytes`)));
2064
+ settle(err(new Error(`${name} output exceeded ${MAX_OUTPUT_BYTES} bytes`)));
2064
2065
  }
2065
2066
  });
2066
2067
  child.on("error", (error) => {
2067
2068
  if (child.pid !== void 0 && child.pid !== null) killTree(child.pid);
2068
- settle(err(new Error(`Process error: ${error.message}`)));
2069
+ settle(err(new Error(`${name} error: ${error.message}`)));
2069
2070
  });
2070
2071
  child.on("close", (code) => {
2071
2072
  settle(ok({ stdout, stderr: stderr6, exitCode: code ?? 1 }));
@@ -2080,7 +2081,7 @@ async function spawnCommand(binary, args, options) {
2080
2081
  windowsHide: true,
2081
2082
  signal: options?.signal
2082
2083
  });
2083
- wireSpawnListeners(child, timeoutMs, resolve);
2084
+ wireSpawnListeners(binary, child, timeoutMs, resolve);
2084
2085
  });
2085
2086
  }
2086
2087
  var PN_REPS = ["Alphabetic", "Ideographic", "Phonetic"];