frpc.js
826 字节
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.createFrpc = createFrpc;
function createFrpc(configPath) {
const { spawn } = require("child_process");
const path = require('path');
console.log("启动 frpc ...");
const frpc = spawn(path.join(__dirname, '..', '..', 'frp', 'frpc'), ["-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