2020-09-28 19:20:33 +08:00
|
|
|
const child = require('child_process')
|
|
|
|
const readline = require('readline')
|
|
|
|
|
|
|
|
exports.exec = function(cmd) {
|
2020-09-29 11:35:49 +08:00
|
|
|
return child.execSync(cmd, {
|
|
|
|
stdio: [process.stdin, process.stdout, process.stdout]
|
|
|
|
})
|
2020-09-28 19:20:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
var rl = readline.createInterface({
|
|
|
|
input: process.stdin,
|
|
|
|
output: process.stdout
|
|
|
|
})
|
|
|
|
|
|
|
|
exports.read = function(msg) {
|
|
|
|
return new Promise(r => {
|
|
|
|
rl.question(msg, _ => {
|
|
|
|
r(_.trim())
|
|
|
|
rl.pause()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|