From 06c12c2ea537b6d33d5a649fd657afc604face4d Mon Sep 17 00:00:00 2001 From: Ted Trask Date: Tue, 28 Oct 2014 19:38:16 +0000 Subject: Minor bug in db.lua when host or port are blank string --- db.lua | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'db.lua') diff --git a/db.lua b/db.lua index 0e8848f..adcc25a 100644 --- a/db.lua +++ b/db.lua @@ -167,15 +167,16 @@ export.listdatabases = function(dbobject) local result = {} if dbobject.engine == mymodule.engine.postgresql then local cmd = {"psql", "-U", "postgres", "-lt"} - if dbobject.host then + if dbobject.host and dbobject.host ~= "" then cmd[#cmd+1] = "-h" cmd[#cmd+1] = dbobject.host end - if dbobject.port then + if dbobject.port and dbobject.port ~= "" then cmd[#cmd+1] = "-p" cmd[#cmd+1] = dbobject.port end cmd["stderr"]=subprocess.STDOUT +APP.logevent("calling: "..table.concat(cmd, " ")) local code, cmdresult = subprocess.call_capture(cmd) if code ~= 0 then error(cmdresult, 0) -- cgit v1.2.3