vuecssuiant-designantdreactantantd-vueenterprisefrontendui-designvue-antdvue-antd-uivue3vuecomponent
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
512 B
28 lines
512 B
'use strict'; |
|
|
|
const isWindows = require('is-windows'); |
|
const getRunCmdEnv = require('./utils/getRunCmdEnv'); |
|
|
|
function runCmd(cmd, _args, fn) { |
|
const args = _args || []; |
|
|
|
if (isWindows()) { |
|
args.unshift(cmd); |
|
args.unshift('/c'); |
|
cmd = process.env.ComSpec; |
|
} |
|
|
|
const runner = require('child_process').spawn(cmd, args, { |
|
// keep color |
|
stdio: 'inherit', |
|
env: getRunCmdEnv(), |
|
}); |
|
|
|
runner.on('close', code => { |
|
if (fn) { |
|
fn(code); |
|
} |
|
}); |
|
} |
|
|
|
module.exports = runCmd;
|
|
|