frpc.js 763 字节
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createFrpc = createFrpc;
function createFrpc(frpcPath, configPath) {
    const { spawn } = require("child_process");
    console.log("启动 frpc ...");
    const frpc = spawn(frpcPath, ["-c", configPath], {
        stdio: "inherit",
    });
    function cleanup() {
        if (!frpc.killed) {
            frpc.kill("SIGTERM");
        }
    }
    process.on("exit", cleanup);
    process.on("SIGINT", () => {
        cleanup();
        process.exit();
    });
    process.on("SIGTERM", () => {
        cleanup();
        process.exit();
    });
    frpc.on("exit", (code) => {
        console.log(`frpc 已退出,代码: ${code}`);
    });
}
//# sourceMappingURL=frpc.js.map