From 34283b2733494f2a3eab890cff79a57a073dc38d Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Wed, 12 Nov 2008 19:05:03 +0000 Subject: [PATCH] =?utf8?q?IPKG=20w=C3=BCrgaround?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- libs/ipkg/luasrc/model/ipkg.lua | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/libs/ipkg/luasrc/model/ipkg.lua b/libs/ipkg/luasrc/model/ipkg.lua index b06834510..3df4bf945 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 -- 2.11.0