Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

t2 update crashes upon downloading files #1044

Closed
afhaque opened this issue Oct 17, 2016 · 3 comments
Closed

t2 update crashes upon downloading files #1044

afhaque opened this issue Oct 17, 2016 · 3 comments
Assignees

Comments

@afhaque
Copy link

afhaque commented Oct 17, 2016

Running into an issue with the t2 update process.

Currently on:
t2-cli: 0.1.0.
t2-firmware: 0.0.13.
Node: 4.4.3 (<- this number stuck even when I upgraded node to 4.6.0).

Output below:
$ t2 update
INFO Looking for your Tessel...
INFO Connected to LilAhmy.
INFO New firmware version found...0.0.16
INFO Updating LilAhmy to latest version (0.0.16)...
INFO Downloading files...
ERR! Detected CLI crash [TypeError: this.stream.clearLine is not a function] TypeError: this.stream.clearLine is not a function
ERR! at ProgressBar.terminate (C:\Users\afhaq\AppData\Roaming\npm\node_modules\t2-cli\node_modules\progress\lib\node-progress.js:177:17)
ERR! at ProgressBar.tick (C:\Users\afhaq\AppData\Roaming\npm\node_modules\t2-cli\node_modules\progress\lib\node-progress.js:91:10)
ERR! at IncomingMessage. (C:\Users\afhaq\AppData\Roaming\npm\node_modules\t2-cli\lib\update-fetch.js:182:13)
ERR! at emitOne (events.js:82:20)
ERR! at IncomingMessage.emit (events.js:169:7)
ERR! at IncomingMessage.Readable.read (_stream_readable.js:368:10)
ERR! at flow (_stream_readable.js:759:26)
ERR! at Gunzip. (_stream_readable.js:616:7)
ERR! at emitNone (events.js:67:13)
ERR! at Gunzip.emit (events.js:166:7)
INFO Download complete!
ERR! TypeError: Cannot read property 'length' of undefined

@tcr
Copy link
Member

tcr commented Oct 17, 2016

Hm, we've gotten crash reports for this issue before.

@rwaldron I think this PR fixes the issue by checking if stderr is a TTY before .terminate (which it doesn't fail to check at the beginning of the .render function): visionmedia/node-progress#99 However, node-progress hasn't been updated in a year, so I'm concerned that PR won't make it upstream.

We can recreate this error by forcing stdout to be a non-TTY. Save as index.js:

var Progress = require('progress');

// Create a new progress bar
var bar = new Progress('     [:bar] :percent :etas remaining', {
  clear: true,
  complete: '=',
  incomplete: ' ',
  width: 20,
  total: 100,
  stream: process.stdout,
});

bar.update(0.5);

// When we get incoming data, update the progress bar
setTimeout(() => {
  bar.update(1.0);
}, 1000);

Then run node test.js | cat:

$ node test.js | cat
/Users/tim/tessel/t2-cli/node_modules/progress/lib/node-progress.js:177
    this.stream.clearLine();
                ^

TypeError: this.stream.clearLine is not a function
    at ProgressBar.terminate (/Users/tim/tessel/t2-cli/node_modules/progress/lib/node-progress.js:177:17)
    at ProgressBar.tick (/Users/tim/tessel/t2-cli/node_modules/progress/lib/node-progress.js:91:10)
    at ProgressBar.update (/Users/tim/tessel/t2-cli/node_modules/progress/lib/node-progress.js:166:8)
    at Timeout.setTimeout (/Users/tim/tessel/t2-cli/test.js:17:7)
    at tryOnTimeout (timers.js:232:11)
    at Timer.listOnTimeout (timers.js:202:5)

@rwaldron
Copy link
Contributor

What shell/terminal/command-line program are you using?

@rwaldron
Copy link
Contributor

Node: 4.4.3 (<- this number stuck even when I upgraded node to 4.6.0).

That's the version on the board, not your local Node.js

rwaldron added a commit that referenced this issue Nov 2, 2016
@rwaldron rwaldron self-assigned this Nov 2, 2016
rwaldron added a commit that referenced this issue Nov 2, 2016
rwaldron added a commit that referenced this issue Nov 3, 2016
…s the patch to terminate. Fixes gh-1073, Fixes gh-1044

Note: this is the same thing as we did with npmlog. When/if the relevant patch is merged to the official node-progress module, we'll drop this and restore that module as a dependency.
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

No branches or pull requests

3 participants