diff options
author | Mika Havela <mika.havela@gmail.com> | 2008-02-15 11:02:01 +0000 |
---|---|---|
committer | Mika Havela <mika.havela@gmail.com> | 2008-02-15 11:02:01 +0000 |
commit | 0c3c51279de900006c67697187c108e7141e1fd1 (patch) | |
tree | 183fc34495cedd7e3ed19cebf3220fe91cb0f04b | |
parent | f1e2dd41fb3b71f2f0e5082cc057ad33a7c6a0d0 (diff) | |
download | acf-tinydns-0c3c51279de900006c67697187c108e7141e1fd1.tar.bz2 acf-tinydns-0c3c51279de900006c67697187c108e7141e1fd1.tar.xz |
Bugfix on when the program is not installed
git-svn-id: svn://svn.alpinelinux.org/acf/tinydns/trunk@724 ab2d0c66-481e-0410-8bed-d214d4d58bed
-rw-r--r-- | tinydns-model.lua | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/tinydns-model.lua b/tinydns-model.lua index 223ce44..b6fa385 100644 --- a/tinydns-model.lua +++ b/tinydns-model.lua @@ -9,11 +9,17 @@ local configfile = "???" -- LOCAL FUNCTIONS local function get_version() + local cmd_output_result, cmd_output_error local cmd = "/sbin/apk_version -vs " .. processname .." 2>/dev/null" local f = io.popen( cmd ) - local cmd_output_result = string.match(f:read("*l"),"^%S*") or "Unknown" + local cmdresult = f:read("*l") + if (cmdresult) and (#cmdresult > 0) then + cmd_output_result = string.match(cmdresult,"^%S*") or "Unknown" + else + cmd_output_error = "Program not installed" + end f:close() - return cmd_output_result + return cmd_output_result,cmd_output_error end -- ################################################################################ @@ -21,9 +27,11 @@ end function getstatus() local status = {} + local version,versionerrtxt = get_version() status.version = cfe({ name = "version", label="Program version", - value=get_version(), + value=version, + errtxt=versionerrtxt, }) status.status = cfe({ name="status", label="Program status", |