Skip to content

Commit

Permalink
Merge pull request #44 from seejee/master
Browse files Browse the repository at this point in the history
Render fails if STDOUT is not a TTY.
  • Loading branch information
jdan committed Oct 16, 2013
2 parents 0867c0a + 7ead74c commit aeac724
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/node-progress.js
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,10 @@ ProgressBar.prototype.tick = function(len, tokens){
*/

ProgressBar.prototype.render = function(tokens){
if(!process.stdout.isTTY) {
return;
}

var percent = (this.curr >= this.total) ? 100 : this.curr / this.total * 100
, complete = Math.round(this.width * (this.curr / this.total))
, incomplete
Expand Down

0 comments on commit aeac724

Please sign in to comment.