Skip to content

Commit

Permalink
echo
Browse files Browse the repository at this point in the history
  • Loading branch information
anixon604 committed Feb 14, 2024
1 parent caa35a0 commit 030b252
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/runner-scripts/close-ports.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ fi

echo "fetch pids"
# Use || true to prevent script exit in case of command failure
pids=$(lsof -iTCP:$lowest_port-$highest_port -sTCP:LISTEN -t) || true
echo "cmd: lsof -iTCP:$lowest_port-$highest_port -sTCP:LISTEN -t"
pids=$(lsof -iTCP:$lowest_port-$highest_port -sTCP:LISTEN -t)

# Check if the lsof command was successful
if [ -z "$pids" ] && [ $? -ne 0 ]; then
Expand All @@ -45,7 +46,8 @@ fi
echo "range done"
echo "Additional ports: ${additional_ports[@]}"
for port in "${additional_ports[@]}"; do
pids=$(lsof -ti TCP:$port) || true
echo "cmd: lsof -ti TCP:$port"
pids=$(lsof -ti TCP:$port)

# Check if the lsof command was successful
if [ -z "$pids" ] && [ $? -ne 0 ]; then
Expand Down

0 comments on commit 030b252

Please sign in to comment.