fix: exec

This commit is contained in:
bietiaop 2024-08-20 14:38:32 +08:00
parent 4ce9b01a1e
commit f698a6ebc3

View file

@ -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;