fix(telegram): исправление порядка объявления функций start_runtime и stop_runtime для корректной работы ucode

This commit is contained in:
Dushnilin
2026-07-13 16:35:16 +03:00
parent aa10487b5e
commit 61cbe3bcc4
+10 -10
View File
@@ -55,7 +55,7 @@ function tg_request(token, method, payload) {
let url = "https://api.telegram.org/bot" + token + "/" + method;
let payload_path = "/tmp/tg_payload_" + method + ".json";
fs.writefile(payload_path, json(payload));
fs.writefile(payload_path, sprintf("%J", payload));
let args = [ "curl", "-s", "-X", "POST", "-H", "Content-Type: application/json", "-d", "@" + payload_path ];
let proxy = get_proxy_args();
@@ -416,6 +416,15 @@ function worker() {
return 0;
}
function stop_runtime() {
let pid = trim(fs.readfile(PID_FILE) || "");
if (pid != "" && match(pid, /^[0-9]+$/) != null && command_success_from_args([ "kill", "-0", pid ])) {
command_success_from_args([ "kill", pid ]);
}
fs.unlink(PID_FILE);
return 0;
}
function start_runtime() {
let cfg = settings();
stop_runtime();
@@ -429,15 +438,6 @@ function start_runtime() {
return command_status(command);
}
function stop_runtime() {
let pid = trim(fs.readfile(PID_FILE) || "");
if (pid != "" && match(pid, /^[0-9]+$/) != null && command_success_from_args([ "kill", "-0", pid ])) {
command_success_from_args([ "kill", pid ]);
}
fs.unlink(PID_FILE);
return 0;
}
function get_status() {
let pid = trim(fs.readfile(PID_FILE) || "");
if (pid != "" && match(pid, /^[0-9]+$/) != null && command_success_from_args([ "kill", "-0", pid ])) {