You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by sp...@apache.org on 2022/05/05 01:53:50 UTC
[apisix] branch master updated: refactor(ops): penlight path instead of shell command mkdir (#6980)
This is an automated email from the ASF dual-hosted git repository.
spacewander pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/apisix.git
The following commit(s) were added to refs/heads/master by this push:
new 6704a02ff refactor(ops): penlight path instead of shell command mkdir (#6980)
6704a02ff is described below
commit 6704a02ffef0572a3bb713c47b143876512e3204
Author: kwanhur <hu...@163.com>
AuthorDate: Thu May 5 09:53:41 2022 +0800
refactor(ops): penlight path instead of shell command mkdir (#6980)
Signed-off-by: kwanhur <hu...@163.com>
---
apisix/cli/ops.lua | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/apisix/cli/ops.lua b/apisix/cli/ops.lua
index 3acdf834f..9a57cf4a9 100644
--- a/apisix/cli/ops.lua
+++ b/apisix/cli/ops.lua
@@ -713,8 +713,15 @@ local function start(env, ...)
util.die("Error: It is forbidden to run APISIX in the /root directory.\n")
end
- local cmd_logs = "mkdir -p " .. env.apisix_home .. "/logs"
- util.execute_cmd(cmd_logs)
+ local logs_path = env.apisix_home .. "/logs"
+ if not pl_path.exists(logs_path) then
+ local _, err = pl_path.mkdir(logs_path)
+ if err ~= nil then
+ util.die("failed to mkdir ", logs_path, ", error: ", err)
+ end
+ elseif not pl_path.isdir(logs_path) and not pl_path.islink(logs_path) then
+ util.die(logs_path, " is not directory nor symbol link")
+ end
-- check running
local pid_path = env.apisix_home .. "/logs/nginx.pid"