mirror of
https://github.com/Jerryplusy/rc-plugin.git
synced 2025-10-14 08:09:19 +00:00
🐞fix:暂时解决网络监控失效问题
This commit is contained in:
parent
8a6b9339e7
commit
b77e67c6d6
5
index.js
5
index.js
@ -1,7 +1,7 @@
|
||||
import fs from "node:fs";
|
||||
import path from "path";
|
||||
import config from "./model/config.js";
|
||||
import { buildNextJs, startNextJs } from "./start-nextjs.js";
|
||||
import { startNextJs } from "./utils/start-nextjs.js";
|
||||
if (!global.segment) {
|
||||
global.segment = (await import("oicq")).segment
|
||||
}
|
||||
@ -41,8 +41,7 @@ for (let i in files) {
|
||||
|
||||
// 检查是否启动 webui
|
||||
if (isOpenWebUI) {
|
||||
buildNextJs()
|
||||
.then(() => startNextJs('start'))
|
||||
startNextJs('dev')
|
||||
}
|
||||
|
||||
export { apps };
|
||||
|
@ -1,7 +1,6 @@
|
||||
import { REDIS_YUNZAI_WEBUI } from "../../../../../constants/constant.js";
|
||||
import { redis } from "../../../../utils/redis.js";
|
||||
|
||||
|
||||
export async function GET(req, res) {
|
||||
const botInfo = JSON.parse(await redis.get(REDIS_YUNZAI_WEBUI));
|
||||
|
||||
|
@ -34,7 +34,7 @@ export const startNextJs = (mode = 'start') => {
|
||||
|
||||
nextjsProcess = spawn('pnpm', ['run', script], {
|
||||
cwd: './plugins/rconsole-plugin', // 指定工作目录
|
||||
stdio: ['ignore', 'ignore', 'ignore', 'ipc'], // 继承父进程的标准输入输出
|
||||
stdio: 'ignore',
|
||||
shell: true,
|
||||
});
|
||||
|
||||
@ -43,6 +43,9 @@ export const startNextJs = (mode = 'start') => {
|
||||
logger.error(`[R插件][Next.js监测],Next.js 进程发生异常 ${code}`);
|
||||
nextjsProcess = null;
|
||||
});
|
||||
nextjsProcess.on('error', (err) => {
|
||||
logger.error(`[R插件][Next.js监测] 子进程错误: ${err.message}`);
|
||||
});
|
||||
};
|
||||
|
||||
// 捕获父进程退出信号
|
Loading…
x
Reference in New Issue
Block a user