diff --git a/internal/aghnet/etchostscontainer.go b/internal/aghnet/etchostscontainer.go index 1d32d584..9cb17c83 100644 --- a/internal/aghnet/etchostscontainer.go +++ b/internal/aghnet/etchostscontainer.go @@ -121,7 +121,9 @@ func (ehc *EtcHostsContainer) Close() { if ehc.watcher != nil { _ = ehc.watcher.Close() } - close(ehc.onlyWritesChan) + + // Don't close onlyWritesChan here and let onlyWrites close it after + // watcher.Events is closed to prevent close races. } // Process returns the list of IP addresses for the hostname or nil if nothing @@ -298,6 +300,8 @@ func (ehc *EtcHostsContainer) onlyWrites() { ehc.onlyWritesChan <- event } } + + close(ehc.onlyWritesChan) } // Receive notifications from fsnotify package diff --git a/scripts/make/build-docker.sh b/scripts/make/build-docker.sh index 138c30dd..df1050e6 100644 --- a/scripts/make/build-docker.sh +++ b/scripts/make/build-docker.sh @@ -27,8 +27,6 @@ else fi readonly version -echo $version - # Allow users to use sudo. sudo_cmd="${SUDO:-}" readonly sudo_cmd diff --git a/scripts/make/clean.sh b/scripts/make/clean.sh index 85301ec1..7fee73f0 100644 --- a/scripts/make/clean.sh +++ b/scripts/make/clean.sh @@ -11,9 +11,8 @@ fi set -e -f -u dist_dir="$DIST_DIR" -go="${GO:-go}" sudo_cmd="${SUDO:-}" -readonly dist_dir go sudo_cmd +readonly dist_dir sudo_cmd $sudo_cmd rm -f\ ./AdGuardHome\ diff --git a/scripts/make/go-lint.sh b/scripts/make/go-lint.sh index c1f14572..e0164612 100644 --- a/scripts/make/go-lint.sh +++ b/scripts/make/go-lint.sh @@ -136,7 +136,7 @@ exit_on_output() ( then if [ "$*" != '' ] then - echo "combined output of '$cmd $@':" + echo "combined output of '$cmd $*':" else echo "combined output of '$cmd':" fi