Software /
code /
prosody
Comparison
util/prosodyctl.lua @ 10536:a469d2bcea96
util.prosodyctl: Silence luacheck warnings
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 23 Dec 2019 21:16:00 +0100 |
parent | 10367:649acbfbf7fe |
child | 10627:88be11e9f9b9 |
comparison
equal
deleted
inserted
replaced
10535:29c1a3bf1d29 | 10536:a469d2bcea96 |
---|---|
208 local file, err = io.open(pidfile, "r+"); | 208 local file, err = io.open(pidfile, "r+"); |
209 if not file then | 209 if not file then |
210 return false, "pidfile-read-failed", err; | 210 return false, "pidfile-read-failed", err; |
211 end | 211 end |
212 | 212 |
213 local locked, err = lfs.lock(file, "w"); | 213 local locked, err = lfs.lock(file, "w"); -- luacheck: ignore 211/err |
214 if locked then | 214 if locked then |
215 file:close(); | 215 file:close(); |
216 return false, "pidfile-not-locked"; | 216 return false, "pidfile-not-locked"; |
217 end | 217 end |
218 | 218 |
225 | 225 |
226 return true, pid; | 226 return true, pid; |
227 end | 227 end |
228 | 228 |
229 local function isrunning() | 229 local function isrunning() |
230 local ok, pid, err = getpid(); | 230 local ok, pid, err = getpid(); -- luacheck: ignore 211/err |
231 if not ok then | 231 if not ok then |
232 if pid == "pidfile-read-failed" or pid == "pidfile-not-locked" then | 232 if pid == "pidfile-read-failed" or pid == "pidfile-not-locked" then |
233 -- Report as not running, since we can't open the pidfile | 233 -- Report as not running, since we can't open the pidfile |
234 -- (it probably doesn't exist) | 234 -- (it probably doesn't exist) |
235 return true, false; | 235 return true, false; |