1
0
mirror of https://github.com/142vip/408CSFamily.git synced 2026-04-24 02:30:36 +08:00

feat: 修正脚本异常

This commit is contained in:
chu fan
2023-09-06 19:24:23 +08:00
parent a7820c499a
commit c003e11b80
6 changed files with 213 additions and 149 deletions

View File

@@ -16,27 +16,6 @@ process.on('exit', () => {
exit()
})
async function syncExec(command){
let size=100
let count = 0;
const intervalId = setInterval(async () => {
console.log('执行中'+'.'.repeat(count),size,count);
count++;
size = await new Promise((resolve,reject)=>{
exec(command,(code)=>{
console.log(code)
console.log('Exit code:', code);
resolve()
})
})
console.log(size)
if (count > size) {
clearInterval(intervalId); // 停止打印
}
}, 1000);
}
/**
* 执行shell指令
* @param commands
@@ -55,11 +34,11 @@ exports.execShell = async commands => {
for (let index=0;index<runCommands.length;index++) {
const command=runCommands[index]
const count=index+1
console.log(`>>>command--${count}:\n ${command} \n<<<command--${count}--start === \n`)
console.log(`>>>command(${count}):\n${command} \n<<<command(${count})--start === \n`)
// await syncExec(command)
const execResult=await exec(command)
console.log(`<<<command--${count}--ending === `)
console.log(`\n<<<command(${count})--ending === `)
// 指令异常,不执行后续指令
if(execResult.code!==0){
break;