From 7ead74c44a39820a33557d571c0b71844b28a0d6 Mon Sep 17 00:00:00 2001 From: Chris Geihsler Date: Wed, 16 Oct 2013 13:30:10 -0400 Subject: [PATCH] Skipping rendering if stdout is not a TTY. --- lib/node-progress.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/node-progress.js b/lib/node-progress.js index 8691327..638d919 100644 --- a/lib/node-progress.js +++ b/lib/node-progress.js @@ -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