Skip to content
This repository has been archived by the owner on May 8, 2018. It is now read-only.

Commit

Permalink
Fix nsp CLI crash in the no window (CI) envs
Browse files Browse the repository at this point in the history
This Fixes the following crash:

> nsp check
  ```
/var/lib/buildkite-agent/builds/ip-10-0-51-163-1/app/node_modules/nsp/node_modules/cli-table/lib/utils.js:11
  return Array(times + 1).join(str);
         ^
 
RangeError: Invalid array length
    at exports.repeat (/var/lib/buildkite-agent/builds/ip-10-0-51-163-1/app/node_modules/nsp/node_modules/cli-table/lib/utils.js:11:10)
    at line (/var/lib/buildkite-agent/builds/ip-10-0-51-163-1/app/node_modules/nsp/node_modules/cli-table/lib/index.js:140:11)
    at lineTop (/var/lib/buildkite-agent/builds/ip-10-0-51-163-1/app/node_modules/nsp/node_modules/cli-table/lib/index.js:154:13)
    at Table.toString (/var/lib/buildkite-agent/builds/ip-10-0-51-163-1/app/node_modules/nsp/node_modules/cli-table/lib/index.js:252:5)
    at /var/lib/buildkite-agent/builds/ip-10-0-51-163-1/app/node_modules/nsp/lib/formatters/default.js:48:27
    at Array.forEach (native)
    at Object.module.exports (/var/lib/buildkite-agent/builds/ip-10-0-51-163-1/app/node_modules/nsp/lib/formatters/default.js:33:6)
    at /var/lib/buildkite-agent/builds/ip-10-0-51-163-1/app/node_modules/nsp/lib/commands/check.js:25:23
    at /var/lib/buildkite-agent/builds/ip-10-0-51-163-1/app/node_modules/nsp/lib/check.js:240:7
    at /var/lib/buildkite-agent/builds/ip-10-0-51-163-1/app/node_modules/nsp/node_modules/wreck/lib/index.js:472:20
```
  • Loading branch information
koresar committed Apr 10, 2017
1 parent ee544f5 commit da2b275
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/formatters/default.js
Expand Up @@ -18,7 +18,7 @@ module.exports = function (err, data, pkgPath) {

var width = 80;
if (process.stdout.isTTY) {
width = process.stdout.getWindowSize()[0] - 10;
width = (process.stdout.getWindowSize()[0] - 10) || 80;
}
if (data.length === 0) {

Expand Down

0 comments on commit da2b275

Please sign in to comment.