Permalink
Browse files

do not output colour to non terminals, fixes #1

  • Loading branch information...
jmoiron committed Jul 22, 2016
1 parent 42496bf commit 74ea42900a2a50e545fb16033262e2b122eaf27c
Showing with 7 additions and 0 deletions.
  1. +7 −0 dmc.go
View
7 dmc.go
@@ -9,6 +9,8 @@ import (
"os/exec"
"strings"
"sync"
"golang.org/x/crypto/ssh/terminal"
)
// dmc runs the command on all hosts passed via stdin simultaneously
@@ -23,7 +25,12 @@ const (
purple
)
var tty = terminal.IsTerminal(int(os.Stdout.Fd()))
func color(s string, color int, bold bool) string {
if !tty {
return s
}
b := "01;"
if !bold {
b = ""

0 comments on commit 74ea429

Please sign in to comment.