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);
frpProcess.processWrapper.on("start", (pid) => {
logger.info(`Instance ${instance.config.nickname}(${instance.instanceUuid}) ${pid} Frp task started!`);
logger.info(`Params: ${openFrpTunnelId} | ${openFrpToken}`);
instance.openFrp = frpProcess;
instance.info.openFrpStatus = true;
frpProcess.processWrapper.on("start", (pid: number) => {
if (pid) {
logger.info(`Instance ${instance.config.nickname}(${instance.instanceUuid}) ${pid} Frp task started!`);
logger.info(`Params: ${openFrpTunnelId} | ${openFrpToken}`);
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", () => {
logger.info(`Instance ${instance.config.nickname}(${instance.instanceUuid}) Frp task stopped!`);