You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by to...@apache.org on 2021/06/15 08:55:57 UTC

[apisix] branch master updated: chore: using util lib to exectue cmd (#4406)

This is an automated email from the ASF dual-hosted git repository.

tokers 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 401a5ef  chore: using util lib to exectue cmd (#4406)
401a5ef is described below

commit 401a5ef2338bc9dd45988131378f7e6e80cc2094
Author: Mayo <ma...@yahoo.co.jp>
AuthorDate: Tue Jun 15 16:55:46 2021 +0800

    chore: using util lib to exectue cmd (#4406)
---
 apisix/cli/ops.lua | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/apisix/cli/ops.lua b/apisix/cli/ops.lua
index 49d0be1..552e821 100644
--- a/apisix/cli/ops.lua
+++ b/apisix/cli/ops.lua
@@ -34,7 +34,6 @@ local type = type
 local tostring = tostring
 local tonumber = tonumber
 local io_open = io.open
-local popen = io.popen
 local execute = os.execute
 local table_insert = table.insert
 local getenv = os.getenv
@@ -672,11 +671,10 @@ local function start(env, ...)
     pid = tonumber(pid)
     if pid then
         local lsof_cmd = "lsof -p " .. pid
-        local hd = popen(lsof_cmd)
-        local res = hd:read("*a")
+        local res, err = util.execute_cmd(lsof_cmd)
         if not (res and res == "") then
             if not res then
-                print("failed to read the result of command: " .. lsof_cmd)
+                print(err)
             else
                 print("APISIX is running...")
             end