summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSteven Barth <steven@midlink.org>2008-11-29 21:58:58 +0000
committerSteven Barth <steven@midlink.org>2008-11-29 21:58:58 +0000
commit285b78a4b47766143f2cc6bf47a46af53c4b05b3 (patch)
treeb2efd48bb9cbfa5cc4d96fc0a25d9a9c27392f3c
parent4f6a244c70828db43967130d50772d2c3933a4a4 (diff)
IPKG würgaround
-rw-r--r--libs/ipkg/luasrc/model/ipkg.lua11
1 files changed, 10 insertions, 1 deletions
diff --git a/libs/ipkg/luasrc/model/ipkg.lua b/libs/ipkg/luasrc/model/ipkg.lua
index b06834510a..3df4bf9451 100644
--- a/libs/ipkg/luasrc/model/ipkg.lua
+++ b/libs/ipkg/luasrc/model/ipkg.lua
@@ -14,6 +14,7 @@ $Id$
]]--
local os = require "os"
+local io = require "io"
local util = require "luci.util"
local type = type
@@ -83,7 +84,15 @@ local function _lookup(act, pkg)
cmd = cmd .. " '" .. pkg:gsub("'", "") .. "'"
end
- return _parselist(util.execi(cmd .. " 2>/dev/null"))
+ -- IPKG sometimes kills the whole machine because it sucks
+ -- Therefore we have to use a sucky approach too and use
+ -- tmpfiles instead of directly reading the output
+ local tmpfile = os.tmpname()
+ os.execute(cmd .. (" >%s 2>/dev/null" % tmpfile))
+
+ local data = _parselist(io.lines(tmpfile))
+ os.remove(tmpfile)
+ return data
end