修改版本信息获取

This commit is contained in:
whyour 2022-11-05 12:14:46 +08:00
parent 23bda39812
commit 7b2c54f6a6

View File

@ -9,6 +9,7 @@ import ScheduleService from './schedule';
import { spawn } from 'child_process'; import { spawn } from 'child_process';
import SockService from './sock'; import SockService from './sock';
import got from 'got'; import got from 'got';
import { promiseExec } from '../config/util';
@Service() @Service()
export default class SystemService { export default class SystemService {
@ -87,10 +88,9 @@ export default class SystemService {
let lastVersion = ''; let lastVersion = '';
let lastLog = ''; let lastLog = '';
try { try {
const result = await got.get(config.lastVersionFile, { const lastVersionFileContent = await promiseExec(
timeout: 30000, `curl ${config.lastVersionFile}`,
}); );
const lastVersionFileContent = result.body;
lastVersion = lastVersionFileContent.match(versionRegx)![1]; lastVersion = lastVersionFileContent.match(versionRegx)![1];
lastLog = lastVersionFileContent.match(logRegx) lastLog = lastVersionFileContent.match(logRegx)
? lastVersionFileContent.match(logRegx)![1] ? lastVersionFileContent.match(logRegx)![1]