UNPKG

@intlayer/chokidar

Version:

Uses chokidar to scan and build Intlayer declaration files into dictionaries based on Intlayer configuration.

42 lines (40 loc) 1.04 kB
import { spawn, spawnSync } from "node:child_process"; //#region src/utils/runParallel/spawnWin32.ts /** * Kills the new process and its sub processes forcibly. */ const createKillHandler = (child) => { return () => { if (!child.pid) return false; try { spawnSync("taskkill", [ "/F", "/T", "/PID", String(child.pid) ], { stdio: "ignore" }); } catch {} return true; }; }; /** * Launches a new process with the given command. * This is almost same as `child_process.spawn`. * * This returns a `ChildProcess` instance. * `kill` method of the instance kills the new process and its sub processes forcibly. * * @param command - The command to run. * @param args - List of string arguments. * @param options - Options. * @returns A ChildProcess instance of new process. * @private */ const spawnWin32 = (command, args, options) => { const child = spawn(command, args, options); child.kill = createKillHandler(child); return child; }; //#endregion export { spawnWin32 }; //# sourceMappingURL=spawnWin32.mjs.map