Brunobkr/llama.cpp_AlgMor24_github
ΩFFFΣLLIa • llama.cpp • AlgMor24 ██████╗ ███████╗███████╗███████╗██╗ ██╗ ██╗ █████╗ ██╔═══██╗██╔════╝██╔════╝██╔════╝██║ ██║ ██║██╔══██╗ ██║ ██║█████╗ █████╗ █████╗ ██║ ██║ ██║███████║ ██║ ██║██╔══╝ ██╔══╝ ██╔══╝ ██║ ██║ ██║██╔══██║ ╚██████╔╝██║ ██║ ███████╗███████╗███████╗██║██║ ██║ ╚═════╝ ╚═╝ ╚═╝ ╚══════╝╚══════╝╚══════╝╚═╝╚═╝ ╚═╝ High-Performance LLM / VLM Inference & Autonomous Agentic Ecosystem… See the full description on the dataset page: https://huggingface.co/datasets/Brunobkr/llama.cpp_AlgMor24_github.
03.1k
1// this spawns a child process that listens for SIGHUP when the2// parent process exits, and after 200ms, sends a SIGKILL to the3// child, in case it did not terminate.4import { spawn } from 'child_process';5const watchdogCode = String.raw `6const pid = parseInt(process.argv[1], 10)7process.title = 'node (foreground-child watchdog pid=' + pid + ')'8if (!isNaN(pid)) {9 let barked = false10 // keepalive11 const interval = setInterval(() => {}, 60000)12 const bark = () => {13 clearInterval(interval)14 if (barked) return15 barked = true16 process.removeListener('SIGHUP', bark)17 setTimeout(() => {18 try {19 process.kill(pid, 'SIGKILL')20 setTimeout(() => process.exit(), 200)21 } catch (_) {}22 }, 500)23 })24 process.on('SIGHUP', bark)25}26`;27/**28 * Pass in a ChildProcess, and this will spawn a watchdog process that29 * will make sure it exits if the parent does, thus preventing any30 * dangling detached zombie processes.31 *32 * If the child ends before the parent, then the watchdog will terminate.33 */34export const watchdog = (child) => {35 let dogExited = false;36 const dog = spawn(process.execPath, ['-e', watchdogCode, String(child.pid)], {37 stdio: 'ignore',38 });39 dog.on('exit', () => (dogExited = true));40 child.on('exit', () => {41 if (!dogExited)42 dog.kill('SIGKILL');43 });44 return dog;45};46//# sourceMappingURL=watchdog.js.map