@wrongstack/tools 0.269.0 → 0.270.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/index.js CHANGED
@@ -1884,8 +1884,7 @@ var bashTool = {
1884
1884
  // Windows children survive parent exit either way. POSIX keeps
1885
1885
  // detached for the process-group kill semantics.
1886
1886
  detached: !isWin3,
1887
- windowsHide: true,
1888
- signal: opts.signal
1887
+ windowsHide: true
1889
1888
  });
1890
1889
  const pid2 = child2.pid;
1891
1890
  if (typeof pid2 === "number") {
@@ -1913,7 +1912,17 @@ var bashTool = {
1913
1912
  };
1914
1913
  child2.stdout?.on("data", onBgData);
1915
1914
  child2.stderr?.on("data", onBgData);
1915
+ const cleanupBackground = () => {
1916
+ child2.stdout?.off("data", onBgData);
1917
+ child2.stderr?.off("data", onBgData);
1918
+ };
1919
+ child2.on("error", () => {
1920
+ cleanupBackground();
1921
+ if (typeof pid2 === "number") registry.unregister(pid2);
1922
+ registry.afterCall(Date.now() - startedAt, true, bypassBreaker);
1923
+ });
1916
1924
  child2.on("close", () => {
1925
+ cleanupBackground();
1917
1926
  registry.afterCall(Date.now() - startedAt, false, bypassBreaker);
1918
1927
  });
1919
1928
  if (typeof pid2 === "number") child2.unref();