@wrongstack/tools 0.281.3 → 0.282.0
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/audit.js +34 -13
- package/dist/audit.js.map +1 -1
- package/dist/bash.js +41 -23
- package/dist/bash.js.map +1 -1
- package/dist/builtin.js +613 -72
- package/dist/builtin.js.map +1 -1
- package/dist/codebase-index/index.js +61 -2
- package/dist/codebase-index/index.js.map +1 -1
- package/dist/codebase-index/worker.js +61 -2
- package/dist/codebase-index/worker.js.map +1 -1
- package/dist/exec.js +34 -13
- package/dist/exec.js.map +1 -1
- package/dist/format.js +34 -13
- package/dist/format.js.map +1 -1
- package/dist/index.d.ts +242 -192
- package/dist/index.js +12613 -12074
- package/dist/index.js.map +1 -1
- package/dist/install.js +34 -13
- package/dist/install.js.map +1 -1
- package/dist/lint.js +34 -13
- package/dist/lint.js.map +1 -1
- package/dist/pack.js +612 -72
- package/dist/pack.js.map +1 -1
- package/dist/process-registry.d.ts +16 -3
- package/dist/process-registry.js +34 -13
- package/dist/process-registry.js.map +1 -1
- package/dist/test.js +34 -13
- package/dist/test.js.map +1 -1
- package/dist/typecheck.js +34 -13
- package/dist/typecheck.js.map +1 -1
- package/dist/write.js +65 -46
- package/dist/write.js.map +1 -1
- package/package.json +2 -2
package/dist/bash.js
CHANGED
|
@@ -403,14 +403,34 @@ function redactCommand(cmd) {
|
|
|
403
403
|
return result;
|
|
404
404
|
}
|
|
405
405
|
var DEFAULT_GRACE_MS = 2e3;
|
|
406
|
-
|
|
406
|
+
var WIN32_TASKKILL_TIMEOUT_MS = 5e3;
|
|
407
|
+
function killWin32Tree(pid, opts = {}) {
|
|
407
408
|
try {
|
|
408
409
|
const child = spawn("taskkill", ["/pid", String(pid), "/T", "/F"], {
|
|
409
410
|
stdio: "ignore",
|
|
410
411
|
windowsHide: true
|
|
411
412
|
});
|
|
412
|
-
|
|
413
|
-
|
|
413
|
+
let settled = false;
|
|
414
|
+
let timeout;
|
|
415
|
+
const settle = () => {
|
|
416
|
+
if (settled) return;
|
|
417
|
+
settled = true;
|
|
418
|
+
if (timeout) clearTimeout(timeout);
|
|
419
|
+
try {
|
|
420
|
+
opts.onSettled?.();
|
|
421
|
+
} catch {
|
|
422
|
+
}
|
|
423
|
+
};
|
|
424
|
+
child.on("error", settle);
|
|
425
|
+
child.on("close", settle);
|
|
426
|
+
timeout = setTimeout(() => {
|
|
427
|
+
try {
|
|
428
|
+
child.kill();
|
|
429
|
+
} catch {
|
|
430
|
+
}
|
|
431
|
+
settle();
|
|
432
|
+
}, Math.max(1, opts.timeoutMs ?? WIN32_TASKKILL_TIMEOUT_MS));
|
|
433
|
+
timeout.unref?.();
|
|
414
434
|
child.unref();
|
|
415
435
|
return true;
|
|
416
436
|
} catch {
|
|
@@ -640,17 +660,18 @@ var ProcessRegistryImpl = class {
|
|
|
640
660
|
const isWin2 = os2.platform() === "win32";
|
|
641
661
|
if (isWin2) {
|
|
642
662
|
const liveRealChild = p.child.exitCode === null && typeof p.child.pid === "number";
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
} catch {
|
|
649
|
-
}
|
|
663
|
+
const directFallback = () => {
|
|
664
|
+
if (p.child.exitCode === null) {
|
|
665
|
+
try {
|
|
666
|
+
p.child.kill("SIGKILL");
|
|
667
|
+
} catch {
|
|
650
668
|
}
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
|
|
669
|
+
}
|
|
670
|
+
};
|
|
671
|
+
if (liveRealChild && killWin32Tree(pid, {
|
|
672
|
+
timeoutMs: Math.max(graceMs, WIN32_TASKKILL_TIMEOUT_MS),
|
|
673
|
+
onSettled: directFallback
|
|
674
|
+
})) ; else {
|
|
654
675
|
try {
|
|
655
676
|
p.child.kill(force ? "SIGKILL" : "SIGTERM");
|
|
656
677
|
} catch {
|
|
@@ -1710,17 +1731,14 @@ var bashTool = {
|
|
|
1710
1731
|
const spool = createOutputSpool({ tool: "bash", thresholdBytes: MAX_OUTPUT });
|
|
1711
1732
|
function killWithTimeout(child2, timeoutMs2) {
|
|
1712
1733
|
if (isWin2) {
|
|
1713
|
-
if (typeof child2.pid === "number" && child2.exitCode === null
|
|
1714
|
-
const
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
}
|
|
1734
|
+
if (typeof child2.pid === "number" && child2.exitCode === null) {
|
|
1735
|
+
const attempted = registry.kill(child2.pid, { force: true, graceMs: timeoutMs2 });
|
|
1736
|
+
if (!attempted) {
|
|
1737
|
+
try {
|
|
1738
|
+
child2.kill();
|
|
1739
|
+
} catch {
|
|
1720
1740
|
}
|
|
1721
|
-
}
|
|
1722
|
-
timers.push(fallback);
|
|
1723
|
-
fallback.unref?.();
|
|
1741
|
+
}
|
|
1724
1742
|
} else {
|
|
1725
1743
|
try {
|
|
1726
1744
|
child2.kill();
|