You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2022/05/04 12:46:49 UTC

[GitHub] [apisix] spacewander commented on a diff in pull request #6980: refactor(ops): penlight path instead of shell command mkdir

spacewander commented on code in PR #6980:
URL: https://github.com/apache/apisix/pull/6980#discussion_r864784053


##########
apisix/cli/ops.lua:
##########
@@ -713,8 +713,16 @@ 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 = env.apisix_home .. "/logs"
+    local logs_path = pl_path.exists(logs)
+    if not logs_path then

Review Comment:
   We can use `if not pl_path.exists`? The `exists` will return the input argument back if it exists, so there is no need to reassign it back.



##########
apisix/cli/ops.lua:
##########
@@ -713,8 +713,16 @@ 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 = env.apisix_home .. "/logs"

Review Comment:
   Using name `logs_path` would be better?



-- 
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: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org