spacewander commented on code in PR #7006:
URL: https://github.com/apache/apisix/pull/7006#discussion_r870918835
##########
apisix/cli/ops.lua:
##########
@@ -728,14 +730,16 @@ local function start(env, ...)
local pid = util.read_file(pid_path)
pid = tonumber(pid)
if pid then
- local lsof_cmd = "lsof -p " .. pid
- local res, err = util.execute_cmd(lsof_cmd)
- if not (res and res == "") then
- if not res then
- print(err)
- else
- print("APISIX is running...")
- end
+ local signone = 0
+
+ local ok, err, err_no = signal.kill(pid, signone)
+ if ok then
+ print("APISIX is running...")
+
Review Comment:
We can save a blank line here?
##########
apisix/cli/ops.lua:
##########
@@ -728,14 +730,16 @@ local function start(env, ...)
local pid = util.read_file(pid_path)
pid = tonumber(pid)
if pid then
- local lsof_cmd = "lsof -p " .. pid
- local res, err = util.execute_cmd(lsof_cmd)
- if not (res and res == "") then
- if not res then
- print(err)
- else
- print("APISIX is running...")
- end
+ local signone = 0
+
+ local ok, err, err_no = signal.kill(pid, signone)
+ if ok then
+ print("APISIX is running...")
+
+ return
+ -- no such process
Review Comment:
The comment is in the wrong place?
##########
apisix/cli/ops.lua:
##########
@@ -728,14 +730,16 @@ local function start(env, ...)
local pid = util.read_file(pid_path)
pid = tonumber(pid)
if pid then
- local lsof_cmd = "lsof -p " .. pid
- local res, err = util.execute_cmd(lsof_cmd)
- if not (res and res == "") then
- if not res then
- print(err)
- else
- print("APISIX is running...")
- end
+ local signone = 0
+
+ local ok, err, err_no = signal.kill(pid, signone)
Review Comment:
The CI is failed sometimes:
https://github.com/apache/apisix/runs/6399336014?check_suite_focus=true
I guess it is caused by the special meaning of pid -1.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]