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 2021/05/31 02:28:58 UTC

[GitHub] [apisix] spacewander commented on a change in pull request #4342: fix: add error handling when use customized config

spacewander commented on a change in pull request #4342:
URL: https://github.com/apache/apisix/pull/4342#discussion_r642173876



##########
File path: apisix/cli/ops.lua
##########
@@ -657,8 +658,18 @@ local function start(env, ...)
     if customized_yaml then
         profile.apisix_home = env.apisix_home .. "/"
         local local_conf_path = profile:yaml_path("config")
-        util.execute_cmd("mv " .. local_conf_path .. " " .. local_conf_path .. ".bak")
-        util.execute_cmd("ln " .. customized_yaml .. " " .. local_conf_path)
+
+        local err = util.execute_cmd_with_error("mv " .. local_conf_path .. " "
+                                                .. local_conf_path .. ".bak")
+        if len(err) > 0 then

Review comment:
       Use `#err` is enough

##########
File path: apisix/cli/util.lua
##########
@@ -47,6 +47,14 @@ function _M.execute_cmd(cmd)
     return data
 end
 
+_M.execute_cmd = execute_cmd
+
+-- For ls and mv which stdout would be always be empty,

Review comment:
       For commands which stdout




-- 
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.

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