Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compatibility of benchmark script and apisix reload command on OSX #1650

Merged
merged 3 commits into from
Jun 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion benchmark/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 9 additions & 5 deletions bin/apisix
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down