From f698a6ebc390717c0ae2e34349ecc15150ea5bf0 Mon Sep 17 00:00:00 2001 From: bietiaop <1527109126@qq.com> Date: Tue, 20 Aug 2024 14:38:32 +0800 Subject: [PATCH] fix: exec --- lib/update.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/update.js b/lib/update.js index ad3ecf7..33e89bb 100644 --- a/lib/update.js +++ b/lib/update.js @@ -1,7 +1,7 @@ import _ from 'lodash'; import { pluginName } from '../lib/path.js'; import { mdLogLineToHTML } from '../utils/data.js'; - +import { exec } from 'child_process'; let Update = null; try { Update = (await import('../../other/update.js').catch(e => null))?.update; @@ -29,7 +29,11 @@ if (Update) { ZZZUpdate = class ZZZUpdate extends Update { exec(cmd, plugin, opts = {}) { if (plugin) opts.cwd = `plugins/${plugin}`; - return Bot.exec(cmd, opts); + return new Promise(resolve => { + exec(cmd, { windowsHide: true }, (error, stdout, stderr) => { + resolve({ error, stdout, stderr }); + }); + }); } async handleLog(remote = false) { @@ -51,6 +55,7 @@ if (Update) { const log = []; let current = true; for (let str of logAll) { + if (!str) continue; str = str.split('||'); if (str[0] === this.oldCommitId) break; if (str[2].includes('Merge')) continue;