diff --git a/aci/etchosts/hosts.go b/aci/etchosts/hosts.go index 7caa23d02..468197ed3 100644 --- a/aci/etchosts/hosts.go +++ b/aci/etchosts/hosts.go @@ -17,7 +17,9 @@ package etchosts import ( + "fmt" "os" + "strings" ) // SetHostNames appends hosts aliases for loopback address to etc/host file @@ -28,6 +30,7 @@ func SetHostNames(file string, hosts ...string) error { } defer f.Close() //nolint:errcheck + fmt.Println("Setting local hosts for " + strings.Join(hosts, ", ")) for _, host := range hosts { _, err = f.WriteString("\n127.0.0.1 " + host) } diff --git a/aci/etchosts/main/main.go b/aci/etchosts/main/main.go index 547d64751..925bb166d 100644 --- a/aci/etchosts/main/main.go +++ b/aci/etchosts/main/main.go @@ -18,10 +18,11 @@ package main import ( "fmt" - "github.com/docker/compose-cli/aci/etchosts" "os" "os/signal" "syscall" + + "github.com/docker/compose-cli/aci/etchosts" ) const hosts = "/etc/hosts" @@ -39,8 +40,8 @@ func main() { } // ACI restart policy is currently at container group level, cannot let the sidecar terminate quietly once /etc/hosts has been edited - // Pause forever (until someone explicitely terminates this process ; go is not happy to stop all goroutines otherwise) - exitSignal := make(chan os.Signal) + // Pause forever (until someone explicitly terminates this process ; go is not happy to stop all goroutines otherwise) + exitSignal := make(chan os.Signal, 1) signal.Notify(exitSignal, syscall.SIGINT, syscall.SIGTERM) <-exitSignal }