UNPKG

t-comm

Version:

专业、稳定、纯粹的工具库

19 lines (17 loc) 485 B
/** * 获取 Node.js child_process 模块(仅支持 Node.js 环境) * @returns child_process 模块 * @throws {Error} 当在非 Node.js 环境中调用时抛出错误 * @example * ```ts * const cp = getChildProcess(); * cp.exec('ls -la', (error, stdout, stderr) => { * console.log(stdout); * }); * ``` */ function getChildProcess() { // eslint-disable-next-line @typescript-eslint/no-require-imports return require('child_process'); } export { getChildProcess };