UNPKG

@intlayer/chokidar

Version:

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

53 lines (51 loc) 1.54 kB
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); const require_runtime = require('../../_virtual/_rolldown/runtime.cjs'); const require_utils_runParallel_bin = require('./bin.cjs'); let node_os = require("node:os"); node_os = require_runtime.__toESM(node_os); //#region src/utils/runParallel/wmic.ts /** * Gets the list of all the pids of the system through the wmic command. * @param callback Callback function with error and process list. */ const wmic = (callback) => { require_utils_runParallel_bin.run("wmic", [ "PROCESS", "get", "ParentProcessId,ProcessId" ], { windowsHide: true, windowsVerbatimArguments: true }, (err, stdout, code) => { if (err) { callback(err); return; } if (code !== 0) { callback(/* @__PURE__ */ new Error(`pidtree wmic command exited with code ${code}`)); return; } if (!stdout) { callback(/* @__PURE__ */ new Error("No stdout received from wmic command")); return; } try { const lines = stdout.split(node_os.EOL); const list = []; for (let i = 1; i < lines.length; i++) { const trimmed = lines[i].trim(); if (!trimmed) continue; const parts = trimmed.split(/\s+/); const ppid = parseInt(parts[0], 10); const pid = parseInt(parts[1], 10); if (!Number.isNaN(ppid) && !Number.isNaN(pid)) list.push([ppid, pid]); } callback(null, list); } catch (error) { callback(error instanceof Error ? error : new Error(String(error))); } }); }; //#endregion exports.wmic = wmic; //# sourceMappingURL=wmic.cjs.map