Prevent progress bar if output is being piped

This commit is contained in:
Andrew Naylor 2015-08-22 02:11:36 +08:00
parent 83726c76be
commit 493308abf9

View file

@ -40,6 +40,11 @@ struct ProgressState {
}
func progress(state: ProgressState) {
// Don't display the progress bar if we're not on a terminal
if isatty(fileno(stdout)) == 0 {
return
}
let barLength = 60
let completeLength = Int(state.percentComplete * Float(barLength))