You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by me...@apache.org on 2020/06/06 01:35:20 UTC
[incubator-apisix] branch master updated: CLI: compatibility of
benchmark script and apisix reload command on OSX (#1650)
This is an automated email from the ASF dual-hosted git repository.
membphis pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-apisix.git
The following commit(s) were added to refs/heads/master by this push:
new 52fa154 CLI: compatibility of benchmark script and apisix reload command on OSX (#1650)
52fa154 is described below
commit 52fa1542170402128f5e929dff0aa0b57713e3ce
Author: 仇柯人 <qi...@163.com>
AuthorDate: Sat Jun 6 09:35:12 2020 +0800
CLI: compatibility of benchmark script and apisix reload command on OSX (#1650)
---
benchmark/run.sh | 7 ++++++-
bin/apisix | 14 +++++++++-----
2 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/benchmark/run.sh b/benchmark/run.sh
index ff068d6..c41b554 100755
--- a/benchmark/run.sh
+++ b/benchmark/run.sh
@@ -36,7 +36,12 @@ function onCtrlC () {
sudo openresty -p $PWD/benchmark/server -s stop || exit 1
}
-sed -i "s/worker_processes [0-9]*/worker_processes $worker_cnt/g" conf/nginx.conf
+if [[ "$(uname)" == "Darwin" ]]; then
+ sed -i "" "s/worker_processes .*/worker_processes $worker_cnt;/g" conf/nginx.conf
+else
+ sed -i "s/worker_processes .*/worker_processes $worker_cnt;/g" conf/nginx.conf
+fi
+
make run
sleep 3
diff --git a/bin/apisix b/bin/apisix
index 98039a2..49c43ed 100755
--- a/bin/apisix
+++ b/bin/apisix
@@ -838,13 +838,17 @@ end
function _M.reload()
local test_cmd = openresty_args .. [[ -t -q ]]
- if os.execute((test_cmd)) ~= 0 then
+ -- When success,
+ -- On linux, os.execute returns 0,
+ -- On macos, os.execute returns 3 values: true, exit, 0, and we need the first.
+ local test_ret = os.execute((test_cmd))
+ if (test_ret == 0 or test_ret == true) then
+ local cmd = openresty_args .. [[ -s reload]]
+ -- print(cmd)
+ os.execute(cmd)
return
end
-
- local cmd = openresty_args .. [[ -s reload]]
- -- print(cmd)
- os.execute(cmd)
+ print("test openresty failed")
end
function _M.version()