Skip to content

Conversation

@seejee
Copy link
Contributor

@seejee seejee commented Oct 16, 2013

We ran into an issue on our Jenkins server when trying to npm install. One of our dependencies uses a progress bar during its installation process, and when installing on the non-interactive shell that Jenkins provides, we ran into the following error:

string_decoder.js:129
  var i = (buffer.length >= 3) ? 3 : buffer.length;
                 ^
TypeError: Cannot read property 'length' of null
    at StringDecoder.detectIncompleteChar (string_decoder.js:129:18)
    at StringDecoder.write (string_decoder.js:99:28)
    at Interface._normalWrite (readline.js:303:30)
    at Interface.write (readline.js:294:49)
    at Interface.ProgressBar.rl.clearLine (/mnt/jenkins/workspace/LessonPlayer-review/node_modules/grunt-contrib-imagemin/node_modules/gifsicle/node_modules/bin-wrapper/node_modules/progress/lib/node-progress.js:46:10)
    at ProgressBar.render (/mnt/jenkins/workspace/LessonPlayer-review/node_modules/grunt-contrib-imagemin/node_modules/gifsicle/node_modules/bin-wrapper/node_modules/progress/lib/node-progress.js:124:11)
    at ProgressBar.tick (/mnt/jenkins/workspace/LessonPlayer-review/node_modules/grunt-contrib-imagemin/node_modules/gifsicle/node_modules/bin-wrapper/node_modules/progress/lib/node-progress.js:83:8)

So, I added a small guard to the render function to skip rendering if STDOUT is not a TTY. This resolved our issue.

Thanks in advance!

jdan added a commit that referenced this pull request Oct 16, 2013
Render fails if STDOUT is not a TTY.
@jdan jdan merged commit aeac724 into visionmedia:master Oct 16, 2013
@jdan
Copy link
Collaborator

jdan commented Oct 16, 2013

Thank you!

$ node examples/download.js| cat

string_decoder.js:129
  var i = (buffer.length >= 3) ? 3 : buffer.length;
                 ^
TypeError: Cannot read property 'length' of null
    at StringDecoder.detectIncompleteChar (string_decoder.js:129:18)
    at StringDecoder.write (string_decoder.js:99:28)
    at Interface._normalWrite (readline.js:303:30)
    at Interface.write (readline.js:294:49)
    at Interface.ProgressBar.rl.clearLine (/Users/jordan/Projects/node-progress/lib/node-progress.js:47:10)
    at ProgressBar.render (/Users/jordan/Projects/node-progress/lib/node-progress.js:127:11)
    at ProgressBar.tick (/Users/jordan/Projects/node-progress/lib/node-progress.js:85:8)
    at next (/Users/jordan/Projects/node-progress/examples/download.js:22:9)
    at Object.<anonymous> (/Users/jordan/Projects/node-progress/examples/download.js:28:3)
    at Module._compile (module.js:456:26)
$ git co pr/44
Branch pr/44 set up to track remote branch pr/44 from origin.
Switched to a new branch 'pr/44'
$ node examples/download.js| cat

$

@kevva
Copy link

kevva commented Oct 17, 2013

@jdan, you mind pushing out a new release?

@hallas
Copy link
Contributor

hallas commented Oct 17, 2013

I just pushed out 1.1.2

@jdan
Copy link
Collaborator

jdan commented Oct 17, 2013

Thanks @hallas :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants