Unverified Commit 3bd282f9 authored by Kroese's avatar Kroese Committed by GitHub
Browse files

feat: Improve Dnsmasq error handling (#1039)

parent 75e5a9b1
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -173,9 +173,11 @@ configureDNS() {
  arguments=$(echo "$arguments" | sed 's/\t/ /g' | tr -s ' ' | sed 's/^ *//')
  [[ "$DEBUG" == [Yy1]* ]] && printf "Dnsmasq arguments:\n\n%s\n\n" "${arguments// -/$'\n-'}"

  if ! $DNSMASQ ${arguments:+ $arguments}; then
  { $DNSMASQ ${arguments:+ $arguments}; rc=$?; } || :

    local msg="Failed to start Dnsmasq, reason: $?"
  if (( rc != 0 )); then

    local msg="Failed to start Dnsmasq, reason: $rc"

    if [[ "${NETWORK,,}" == "slirp" || "${NETWORK,,}" == "passt" || "$ROOTLESS" != [Yy1]* || "$DEBUG" == [Yy1]* ]]; then
      [ -f "$log" ] && [ -s "$log" ] && cat "$log"
@@ -293,9 +295,8 @@ getUserPorts() {
  done

  # Remove duplicates
  ports=$(echo "${ports//,,/,}," | awk 'BEGIN{RS=ORS=","} !seen[$0]++' | sed 's/,*$//g')
  echo "${ports//,,/,}," | awk 'BEGIN{RS=ORS=","} !seen[$0]++' | sed 's/,*$//g'

  echo "$ports"
  return 0
}