projects
/
project
/
luci.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
luci-app-nlbw: fix sporadic premature EOF when rendering JSON data
[project/luci.git]
/
applications
/
luci-app-nlbwmon
/
luasrc
/
controller
/
nlbw.lua
diff --git
a/applications/luci-app-nlbwmon/luasrc/controller/nlbw.lua
b/applications/luci-app-nlbwmon/luasrc/controller/nlbw.lua
index
bb56bc6
..
a8c5779
100644
(file)
--- 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)
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
end
- if w
pid and stat == "exited"
then
- break
+ if w
riter
then
+ writer(buffer)
end
end
end
end
+
+ nixio.waitpid(pid)
elseif pid == 0 then
nixio.dup(fdo, nixio.stdout)
fdi:close()
elseif pid == 0 then
nixio.dup(fdo, nixio.stdout)
fdi:close()