@ubercode/dcmtk 0.9.4 → 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-zdzuZTms.d.cts → index-CEqwLKgE.d.cts} +2 -4
- package/dist/{index-x98H349Q.d.ts → index-Hp4Ri9y5.d.ts} +2 -4
- package/dist/index.cjs +346 -292
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +333 -279
- package/dist/index.js.map +1 -1
- package/dist/retry-Aryrk1uP.d.ts +112 -0
- package/dist/retry-CJ60nZxE.d.cts +112 -0
- package/dist/servers.cjs +472 -420
- package/dist/servers.cjs.map +1 -1
- package/dist/servers.d.cts +1 -1
- package/dist/servers.d.ts +1 -1
- package/dist/servers.js +465 -413
- 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/dist/utils.cjs +46 -0
- package/dist/utils.cjs.map +1 -1
- package/dist/utils.d.cts +21 -94
- package/dist/utils.d.ts +21 -94
- package/dist/utils.js +43 -1
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
package/dist/tools.js
CHANGED
|
@@ -40,13 +40,14 @@ async function execCommand(binary, args, options) {
|
|
|
40
40
|
windowsHide: true,
|
|
41
41
|
signal: options?.signal
|
|
42
42
|
});
|
|
43
|
-
wireSpawnListeners(child, timeoutMs, resolve);
|
|
43
|
+
wireSpawnListeners(binary, child, timeoutMs, resolve);
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
|
-
function wireSpawnListeners(child, timeoutMs, resolve) {
|
|
46
|
+
function wireSpawnListeners(binary, child, timeoutMs, resolve) {
|
|
47
47
|
let stdout = "";
|
|
48
48
|
let stderr3 = "";
|
|
49
49
|
let settled = false;
|
|
50
|
+
const name = binary.split("/").pop() ?? binary;
|
|
50
51
|
const settle = (result) => {
|
|
51
52
|
if (settled) return;
|
|
52
53
|
settled = true;
|
|
@@ -55,25 +56,25 @@ function wireSpawnListeners(child, timeoutMs, resolve) {
|
|
|
55
56
|
};
|
|
56
57
|
const timer = setTimeout(() => {
|
|
57
58
|
if (child.pid !== void 0 && child.pid !== null) killTree(child.pid);
|
|
58
|
-
settle(err(new Error(
|
|
59
|
+
settle(err(new Error(`${name} timed out after ${timeoutMs}ms (pid: ${String(child.pid ?? "unknown")})`)));
|
|
59
60
|
}, timeoutMs);
|
|
60
61
|
child.stdout?.on("data", (chunk) => {
|
|
61
62
|
stdout += String(chunk);
|
|
62
63
|
if (stdout.length + stderr3.length > MAX_OUTPUT_BYTES) {
|
|
63
64
|
if (child.pid !== void 0 && child.pid !== null) killTree(child.pid);
|
|
64
|
-
settle(err(new Error(
|
|
65
|
+
settle(err(new Error(`${name} output exceeded ${MAX_OUTPUT_BYTES} bytes`)));
|
|
65
66
|
}
|
|
66
67
|
});
|
|
67
68
|
child.stderr?.on("data", (chunk) => {
|
|
68
69
|
stderr3 += String(chunk);
|
|
69
70
|
if (stdout.length + stderr3.length > MAX_OUTPUT_BYTES) {
|
|
70
71
|
if (child.pid !== void 0 && child.pid !== null) killTree(child.pid);
|
|
71
|
-
settle(err(new Error(
|
|
72
|
+
settle(err(new Error(`${name} output exceeded ${MAX_OUTPUT_BYTES} bytes`)));
|
|
72
73
|
}
|
|
73
74
|
});
|
|
74
75
|
child.on("error", (error) => {
|
|
75
76
|
if (child.pid !== void 0 && child.pid !== null) killTree(child.pid);
|
|
76
|
-
settle(err(new Error(
|
|
77
|
+
settle(err(new Error(`${name} error: ${error.message}`)));
|
|
77
78
|
});
|
|
78
79
|
child.on("close", (code) => {
|
|
79
80
|
settle(ok({ stdout, stderr: stderr3, exitCode: code ?? 1 }));
|
|
@@ -88,7 +89,7 @@ async function spawnCommand(binary, args, options) {
|
|
|
88
89
|
windowsHide: true,
|
|
89
90
|
signal: options?.signal
|
|
90
91
|
});
|
|
91
|
-
wireSpawnListeners(child, timeoutMs, resolve);
|
|
92
|
+
wireSpawnListeners(binary, child, timeoutMs, resolve);
|
|
92
93
|
});
|
|
93
94
|
}
|
|
94
95
|
|