@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.js
CHANGED
|
@@ -293,13 +293,14 @@ async function execCommand(binary, args, options) {
|
|
|
293
293
|
windowsHide: true,
|
|
294
294
|
signal: options?.signal
|
|
295
295
|
});
|
|
296
|
-
wireSpawnListeners(child, timeoutMs, resolve);
|
|
296
|
+
wireSpawnListeners(binary, child, timeoutMs, resolve);
|
|
297
297
|
});
|
|
298
298
|
}
|
|
299
|
-
function wireSpawnListeners(child, timeoutMs, resolve) {
|
|
299
|
+
function wireSpawnListeners(binary, child, timeoutMs, resolve) {
|
|
300
300
|
let stdout = "";
|
|
301
301
|
let stderr8 = "";
|
|
302
302
|
let settled = false;
|
|
303
|
+
const name = binary.split("/").pop() ?? binary;
|
|
303
304
|
const settle = (result) => {
|
|
304
305
|
if (settled) return;
|
|
305
306
|
settled = true;
|
|
@@ -308,25 +309,25 @@ function wireSpawnListeners(child, timeoutMs, resolve) {
|
|
|
308
309
|
};
|
|
309
310
|
const timer = setTimeout(() => {
|
|
310
311
|
if (child.pid !== void 0 && child.pid !== null) killTree(child.pid);
|
|
311
|
-
settle(err(new Error(
|
|
312
|
+
settle(err(new Error(`${name} timed out after ${timeoutMs}ms (pid: ${String(child.pid ?? "unknown")})`)));
|
|
312
313
|
}, timeoutMs);
|
|
313
314
|
child.stdout?.on("data", (chunk) => {
|
|
314
315
|
stdout += String(chunk);
|
|
315
316
|
if (stdout.length + stderr8.length > MAX_OUTPUT_BYTES) {
|
|
316
317
|
if (child.pid !== void 0 && child.pid !== null) killTree(child.pid);
|
|
317
|
-
settle(err(new Error(
|
|
318
|
+
settle(err(new Error(`${name} output exceeded ${MAX_OUTPUT_BYTES} bytes`)));
|
|
318
319
|
}
|
|
319
320
|
});
|
|
320
321
|
child.stderr?.on("data", (chunk) => {
|
|
321
322
|
stderr8 += String(chunk);
|
|
322
323
|
if (stdout.length + stderr8.length > MAX_OUTPUT_BYTES) {
|
|
323
324
|
if (child.pid !== void 0 && child.pid !== null) killTree(child.pid);
|
|
324
|
-
settle(err(new Error(
|
|
325
|
+
settle(err(new Error(`${name} output exceeded ${MAX_OUTPUT_BYTES} bytes`)));
|
|
325
326
|
}
|
|
326
327
|
});
|
|
327
328
|
child.on("error", (error) => {
|
|
328
329
|
if (child.pid !== void 0 && child.pid !== null) killTree(child.pid);
|
|
329
|
-
settle(err(new Error(
|
|
330
|
+
settle(err(new Error(`${name} error: ${error.message}`)));
|
|
330
331
|
});
|
|
331
332
|
child.on("close", (code) => {
|
|
332
333
|
settle(ok({ stdout, stderr: stderr8, exitCode: code ?? 1 }));
|
|
@@ -341,7 +342,7 @@ async function spawnCommand(binary, args, options) {
|
|
|
341
342
|
windowsHide: true,
|
|
342
343
|
signal: options?.signal
|
|
343
344
|
});
|
|
344
|
-
wireSpawnListeners(child, timeoutMs, resolve);
|
|
345
|
+
wireSpawnListeners(binary, child, timeoutMs, resolve);
|
|
345
346
|
});
|
|
346
347
|
}
|
|
347
348
|
var ProcessState = {
|