X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=blobdiff_plain;f=applications%2Fluci-app-nlbwmon%2Fluasrc%2Fcontroller%2Fnlbw.lua;fp=applications%2Fluci-app-nlbwmon%2Fluasrc%2Fcontroller%2Fnlbw.lua;h=a8c577929ab93f6cf732ec06edd3eb88d4f90eee;hp=bb56bc6e6eb7bc297d6c7b96203ee3e4397a21bb;hb=08916f4335e96e4a3c9dcf77262fa151348ed93c;hpb=a441721d32d06d18368bf236ad127ffccad0bef8 diff --git a/applications/luci-app-nlbwmon/luasrc/controller/nlbw.lua b/applications/luci-app-nlbwmon/luasrc/controller/nlbw.lua index bb56bc6e6..a8c577929 100644 --- a/applications/luci-app-nlbwmon/luasrc/controller/nlbw.lua +++ b/applications/luci-app-nlbwmon/luasrc/controller/nlbw.lua @@ -28,16 +28,17 @@ local function exec(cmd, args, writer) while true do local buffer = fdi:read(2048) - local wpid, stat, code = nixio.waitpid(pid, "nohang") - if writer and buffer and #buffer > 0 then - writer(buffer) + if not buffer or #buffer == 0 then + break end - if wpid and stat == "exited" then - break + if writer then + writer(buffer) end end + + nixio.waitpid(pid) elseif pid == 0 then nixio.dup(fdo, nixio.stdout) fdi:close()