Fix: check pid when frp started

This commit is contained in:
unitwk 2023-01-15 16:21:47 +08:00
parent 82878b1299
commit 33eea8a7b7

View File

@ -69,11 +69,15 @@ export default class OpenFrpTask implements ILifeCycleTask {
} }
const frpProcess = new OpenFrp(openFrpToken, openFrpTunnelId); const frpProcess = new OpenFrp(openFrpToken, openFrpTunnelId);
frpProcess.processWrapper.on("start", (pid) => { frpProcess.processWrapper.on("start", (pid: number) => {
logger.info(`Instance ${instance.config.nickname}(${instance.instanceUuid}) ${pid} Frp task started!`); if (pid) {
logger.info(`Params: ${openFrpTunnelId} | ${openFrpToken}`); logger.info(`Instance ${instance.config.nickname}(${instance.instanceUuid}) ${pid} Frp task started!`);
instance.openFrp = frpProcess; logger.info(`Params: ${openFrpTunnelId} | ${openFrpToken}`);
instance.info.openFrpStatus = true; instance.openFrp = frpProcess;
instance.info.openFrpStatus = true;
} else {
logger.warn(`Instance ${instance.config.nickname}(${instance.instanceUuid}) Frp task start failed! Process ID is ${pid}`);
}
}); });
frpProcess.processWrapper.on("exit", () => { frpProcess.processWrapper.on("exit", () => {
logger.info(`Instance ${instance.config.nickname}(${instance.instanceUuid}) Frp task stopped!`); logger.info(`Instance ${instance.config.nickname}(${instance.instanceUuid}) Frp task stopped!`);