EdgeAIG's picture
download
raw
1.09 kB
import { spawnSync } from "node:child_process";
// Duplicated from `packages/opencode/src/util/process.ts` because the SDK cannot
// import `opencode` without creating a cycle (`opencode` depends on `@opencode-ai/sdk`).
export function stop(proc) {
if (proc.exitCode !== null || proc.signalCode !== null)
return;
if (process.platform === "win32" && proc.pid) {
const out = spawnSync("taskkill", ["/pid", String(proc.pid), "/T", "/F"], { windowsHide: true });
if (!out.error && out.status === 0)
return;
}
proc.kill();
}
export function bindAbort(proc, signal, onAbort) {
if (!signal)
return () => { };
const abort = () => {
clear();
stop(proc);
onAbort?.();
};
const clear = () => {
signal.removeEventListener("abort", abort);
proc.off("exit", clear);
proc.off("error", clear);
};
signal.addEventListener("abort", abort, { once: true });
proc.on("exit", clear);
proc.on("error", clear);
if (signal.aborted)
abort();
return clear;
}

Xet Storage Details

Size:
1.09 kB
·
Xet hash:
63ac1483ecb1f1bc6bb0856389452fff284571d9705bc848657da96c7a2dfa16

Xet efficiently stores files, intelligently splitting them into unique chunks and accelerating uploads and downloads. More info.