|
|
@ -310,8 +310,8 @@ openim::util::check_ports() {
|
|
|
|
info=$(netstat -ltnp | grep ":$port" || true)
|
|
|
|
info=$(netstat -ltnp | grep ":$port" || true)
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
|
|
|
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
|
|
|
# For macOS, use netstat
|
|
|
|
# For macOS, use lsof
|
|
|
|
info=$(netstat -an -p tcp | grep "\.$port " || true)
|
|
|
|
info=$(lsof -i:"$port" | grep "\*:$port" || true)
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Check if any process is using the port
|
|
|
|
# Check if any process is using the port
|
|
|
@ -326,9 +326,9 @@ openim::util::check_ports() {
|
|
|
|
fd=$(echo $details | awk '{print $3}')
|
|
|
|
fd=$(echo $details | awk '{print $3}')
|
|
|
|
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
|
|
|
elif [[ "$OSTYPE" == "darwin"* ]]; then
|
|
|
|
# Handle extraction for macOS
|
|
|
|
# Handle extraction for macOS
|
|
|
|
pid=$(echo $info | awk '{print $9}' | cut -d'/' -f1)
|
|
|
|
pid=$(echo $info | awk '{print $2}' | cut -d'/' -f1)
|
|
|
|
command=$(ps -p $pid -o comm=)
|
|
|
|
command=$(ps -p $pid -o comm= | xargs basename)
|
|
|
|
fd="N/A" # File Descriptor is not available in macOS netstat output
|
|
|
|
fd=$(echo $info | awk '{print $4}' | cut -d'/' -f1)
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
# Get the start time of the process using the PID
|
|
|
|
# Get the start time of the process using the PID
|
|
|
|