]> ruderich.org/simon Gitweb - safcm/safcm.git/blobdiff - cmd/safcm/sync.go
safcm: don't color output if stderr is redirected
[safcm/safcm.git] / cmd / safcm / sync.go
index 77e83c4187592ca1bd5cc31e44da3f4acfb4830d..54df9ec6230efc8cffda0ff347960efb0317a61a 100644 (file)
@@ -122,7 +122,8 @@ func MainSync(args []string) error {
                return fmt.Errorf("no hosts found")
        }
 
-       isTTY := term.IsTerminal(int(os.Stdout.Fd()))
+       isTTY := term.IsTerminal(int(os.Stdout.Fd())) &&
+               term.IsTerminal(int(os.Stderr.Fd()))
 
        done := make(chan bool)
        // Collect events from all hosts and print them
@@ -226,10 +227,7 @@ func MainSync(args []string) error {
 func hostsToSync(names []string, allHosts *config.Hosts,
        allGroups map[string][]string) ([]*config.Host, error) {
 
-       detectedMap := make(map[string]bool)
-       for _, x := range config.TransitivelyDetectedGroups(allGroups) {
-               detectedMap[x] = true
-       }
+       detectedMap := config.TransitivelyDetectedGroups(allGroups)
 
        const detectedErr = `