UNPKG

t-comm

Version:

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

23 lines (19 loc) 579 B
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); /** * 获取 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'); } exports.getChildProcess = getChildProcess;