Avoid some blocking issues
This commit is contained in:
parent
bf7287c60d
commit
df723f9d9e
2 changed files with 3 additions and 12 deletions
|
@ -61,6 +61,7 @@ function run()
|
||||||
elseif id == 4 then
|
elseif id == 4 then
|
||||||
io.write(data1)
|
io.write(data1)
|
||||||
elseif id == 5 then
|
elseif id == 5 then
|
||||||
|
io.close()
|
||||||
active = false
|
active = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -67,7 +67,7 @@ function flash(image, kpattern)
|
||||||
if kpattern then
|
if kpattern then
|
||||||
cmd = cmd .. "-k '" .. kpattern:gsub("'", "") .. "' "
|
cmd = cmd .. "-k '" .. kpattern:gsub("'", "") .. "' "
|
||||||
end
|
end
|
||||||
cmd = cmd .. "'" .. image:gsub("'", "") .. "' 2>/dev/null"
|
cmd = cmd .. "'" .. image:gsub("'", "") .. "' 2>/dev/null &"
|
||||||
|
|
||||||
local fp = io.popen(cmd)
|
local fp = io.popen(cmd)
|
||||||
fp:setvbuf("no")
|
fp:setvbuf("no")
|
||||||
|
@ -78,18 +78,8 @@ function flash(image, kpattern)
|
||||||
fp:close()
|
fp:close()
|
||||||
return false, line
|
return false, line
|
||||||
else
|
else
|
||||||
line = fp:read()
|
|
||||||
if line == "Performing system upgrade..." then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
line = fp:read()
|
|
||||||
if line == "Performing system upgrade..." then
|
|
||||||
return true
|
|
||||||
end
|
|
||||||
|
|
||||||
fp:close()
|
fp:close()
|
||||||
return false, line
|
return true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue