From 127954b2fb1248e266b55f625f5f982b81b454a6 Mon Sep 17 00:00:00 2001 From: "Bastian (BaM)" Date: Fri, 19 Sep 2025 11:58:29 +0200 Subject: [PATCH] Fix command execution in network.send_wol to handle return values correctly. --- scripts/network.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/network.lua b/scripts/network.lua index dc2bdd9..fd930a1 100644 --- a/scripts/network.lua +++ b/scripts/network.lua @@ -74,7 +74,7 @@ function network.port_is_up(host, port, timeout_sec, check_interval_sec) if (os.time() - start_time) < timeout then if not retry_message_sent then utils.log("Port " .. - port .. " not yet available on " .. host .. ", retrying every " .. check_interval_sec .. "s...") + port .. " not yet available on " .. host .. ", retrying every " .. check_interval_sec .. "s...") retry_message_sent = true end os.execute("sleep " .. check_interval_sec) @@ -148,8 +148,9 @@ function network.send_wol(mac_str, bcast_ip, port) if not network.is_socket_available() then utils.log("Socket module not available, using external wol tool") local cmd = string.format("wol -i %s -p %d %s", bcast_ip, port, mac_str) - local result = os.execute(cmd) - return result == 0, result ~= 0 and "wol command failed" or nil + local ok, reason, code = os.execute(cmd) + return ok and reason == "exit" and code == 0, + (not ok or reason ~= "exit" or code ~= 0) and "wol command failed" or nil end -- Create IPv4 UDP socket (udp4 if available), bind to IPv4 wildcard to lock AF_INET