diff options
-rw-r--r-- | skins-model.lua | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/skins-model.lua b/skins-model.lua index e637023..f4b4de6 100644 --- a/skins-model.lua +++ b/skins-model.lua @@ -6,7 +6,7 @@ local function set_skins(skin) local f, errtxt = io.popen(cmd) local cmdoutput = f:read("*a") f:close() - return cfe({ value=cmdoutput, errtxt=errtxt, label="Set skin result" }) + return cmdoutput, errtxt end local function list_skins() @@ -32,9 +32,12 @@ end update = function (newskin) -- Make sure no one can inject code into the model. local availableskins = list_skins() + local cmdoutput = "Failed to set skin" + local errtxt = "Invalid selection" for i,skin in ipairs(availableskins.value) do if ( skin.value == newskin) then - return set_skins(newskin) + cmdoutput, errtxt = set_skins(newskin) end end + return cfe({ value=cmdoutput, errtxt=errtxt, label="Set skin result" }) end |