Skip to content

Commit bcaa5f1

Browse files
authored
fix(server): fix check_port port extraction for schemeless URLs (#3005)
1 parent 7afce9d commit bcaa5f1

3 files changed

Lines changed: 3 additions & 3 deletions

File tree

  • hugegraph-pd/hg-pd-dist/src/assembly/static/bin
  • hugegraph-server/hugegraph-dist/src/assembly/static/bin
  • hugegraph-store/hg-store-dist/src/assembly/static/bin

hugegraph-pd/hg-pd-dist/src/assembly/static/bin/util.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ function process_id() {
8383

8484
# check the port of rest server is occupied
8585
function check_port() {
86-
local port=`echo $1 | awk -F':' '{print $3}'`
86+
local port=$(echo "$1" | sed 's|.*:||' | sed 's|/.*||')
8787
if ! command_available "lsof"; then
8888
echo "Required lsof but it is unavailable"
8989
exit 1

hugegraph-server/hugegraph-dist/src/assembly/static/bin/util.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ function process_id() {
8181

8282
# check the port of rest server is occupied
8383
function check_port() {
84-
local port=$(echo "$1" | awk -F':' '{print $3}')
84+
local port=$(echo "$1" | sed 's|.*:||' | sed 's|/.*||')
8585
if ! command_available "lsof"; then
8686
echo "Required lsof but it is unavailable"
8787
exit 1

hugegraph-store/hg-store-dist/src/assembly/static/bin/util.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ function process_id() {
8282

8383
# check the port of rest server is occupied
8484
function check_port() {
85-
local port=`echo $1 | awk -F':' '{print $3}'`
85+
local port=$(echo "$1" | sed 's|.*:||' | sed 's|/.*||')
8686
if ! command_available "lsof"; then
8787
echo "Required lsof but it is unavailable"
8888
exit 1

0 commit comments

Comments
 (0)