diff --git a/app.js b/app.js index c92b8bc..287eb2b 100644 --- a/app.js +++ b/app.js @@ -14,6 +14,13 @@ const haveGit = fs.existsSync('./.git'); * 2. 添加GIT源 * 3. 设置默认源以供一键上传 */ +// exec('git status', function (error, stdout, stderr) { +// let str = stdout.replace(/( |\\n)/g, ''); +// console.log(str); + +// }) +// return + function getBranch() { return new Promise((resolve, reject) => { exec('git branch', function (error, stdout, stderr) { @@ -59,7 +66,7 @@ function getBranch() { let branch = await getBranch(); //当前分支 for (let i = 0; i < origin.length; i++) { const o = origin[i]; - await git_util.all('a', o, branch); + await git_util.all(o, branch); } } else { inquirer.prompt([{ diff --git a/git_util.js b/git_util.js index 6f05dde..5a85633 100644 --- a/git_util.js +++ b/git_util.js @@ -7,7 +7,7 @@ module.exports = { if (error) { reject(error); console.log(error); - return; + // return; } console.log("git commit -m '" + msg + "'"); exec("git commit -m '" + msg + "'", function (error, stdout, stderr) { @@ -47,13 +47,15 @@ module.exports = { }) }, push(origin, banch) { - exec(banch ? "git push " + origin + " " + banch : "git push " + origin, function (error, stdout, stderr) { - if (error) { - reject(error); - console.log(error); - return; - } - resolve(); + return new Promise((resolve, reject) => { + exec(banch ? "git push " + origin + " " + banch : "git push " + origin, function (error, stdout, stderr) { + if (error) { + reject(error); + console.log(error); + return; + } + resolve(); + }) }) } } \ No newline at end of file