@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/dicom.cjs +8 -7
- package/dist/dicom.cjs.map +1 -1
- package/dist/dicom.js +8 -7
- package/dist/dicom.js.map +1 -1
- package/dist/index.cjs +8 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -7
- package/dist/index.js.map +1 -1
- package/dist/servers.cjs +8 -7
- package/dist/servers.cjs.map +1 -1
- package/dist/servers.js +8 -7
- package/dist/servers.js.map +1 -1
- package/dist/tools.cjs +8 -7
- package/dist/tools.cjs.map +1 -1
- package/dist/tools.js +8 -7
- package/dist/tools.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -318,13 +318,14 @@ async function execCommand(binary, args, options) {
|
|
|
318
318
|
windowsHide: true,
|
|
319
319
|
signal: options?.signal
|
|
320
320
|
});
|
|
321
|
-
wireSpawnListeners(child, timeoutMs, resolve);
|
|
321
|
+
wireSpawnListeners(binary, child, timeoutMs, resolve);
|
|
322
322
|
});
|
|
323
323
|
}
|
|
324
|
-
function wireSpawnListeners(child, timeoutMs, resolve) {
|
|
324
|
+
function wireSpawnListeners(binary, child, timeoutMs, resolve) {
|
|
325
325
|
let stdout = "";
|
|
326
326
|
let stderr8 = "";
|
|
327
327
|
let settled = false;
|
|
328
|
+
const name = binary.split("/").pop() ?? binary;
|
|
328
329
|
const settle = (result) => {
|
|
329
330
|
if (settled) return;
|
|
330
331
|
settled = true;
|
|
@@ -333,25 +334,25 @@ function wireSpawnListeners(child, timeoutMs, resolve) {
|
|
|
333
334
|
};
|
|
334
335
|
const timer = setTimeout(() => {
|
|
335
336
|
if (child.pid !== void 0 && child.pid !== null) killTree(child.pid);
|
|
336
|
-
settle(err(new Error(
|
|
337
|
+
settle(err(new Error(`${name} timed out after ${timeoutMs}ms (pid: ${String(child.pid ?? "unknown")})`)));
|
|
337
338
|
}, timeoutMs);
|
|
338
339
|
child.stdout?.on("data", (chunk) => {
|
|
339
340
|
stdout += String(chunk);
|
|
340
341
|
if (stdout.length + stderr8.length > MAX_OUTPUT_BYTES) {
|
|
341
342
|
if (child.pid !== void 0 && child.pid !== null) killTree(child.pid);
|
|
342
|
-
settle(err(new Error(
|
|
343
|
+
settle(err(new Error(`${name} output exceeded ${MAX_OUTPUT_BYTES} bytes`)));
|
|
343
344
|
}
|
|
344
345
|
});
|
|
345
346
|
child.stderr?.on("data", (chunk) => {
|
|
346
347
|
stderr8 += String(chunk);
|
|
347
348
|
if (stdout.length + stderr8.length > MAX_OUTPUT_BYTES) {
|
|
348
349
|
if (child.pid !== void 0 && child.pid !== null) killTree(child.pid);
|
|
349
|
-
settle(err(new Error(
|
|
350
|
+
settle(err(new Error(`${name} output exceeded ${MAX_OUTPUT_BYTES} bytes`)));
|
|
350
351
|
}
|
|
351
352
|
});
|
|
352
353
|
child.on("error", (error) => {
|
|
353
354
|
if (child.pid !== void 0 && child.pid !== null) killTree(child.pid);
|
|
354
|
-
settle(err(new Error(
|
|
355
|
+
settle(err(new Error(`${name} error: ${error.message}`)));
|
|
355
356
|
});
|
|
356
357
|
child.on("close", (code) => {
|
|
357
358
|
settle(ok({ stdout, stderr: stderr8, exitCode: code ?? 1 }));
|
|
@@ -366,7 +367,7 @@ async function spawnCommand(binary, args, options) {
|
|
|
366
367
|
windowsHide: true,
|
|
367
368
|
signal: options?.signal
|
|
368
369
|
});
|
|
369
|
-
wireSpawnListeners(child, timeoutMs, resolve);
|
|
370
|
+
wireSpawnListeners(binary, child, timeoutMs, resolve);
|
|
370
371
|
});
|
|
371
372
|
}
|
|
372
373
|
var ProcessState = {
|