aksakalli / gtop

System monitoring dashboard for terminal
MIT License
9.74k stars 326 forks source link

RangeError: "size" argument must not be negative #53

Closed montanaflynn closed 7 years ago

montanaflynn commented 7 years ago

Environment

Description

When I run gtop I get this error:


RangeError: "size" argument must not be negative
    at Function.Buffer.allocUnsafe (buffer.js:151:3)
    at new Buffer (buffer.js:83:19)
    at new Canvas (/usr/local/lib/node_modules/gtop/node_modules/drawille-blessed-contrib/index.js:17:18)
    at new Context (/usr/local/lib/node_modules/gtop/node_modules/drawille-canvas-blessed-contrib/index.js:11:18)
    at module.exports.Canvas.getContext (/usr/local/lib/node_modules/gtop/node_modules/drawille-canvas-blessed-contrib/index.js:274:24)
    at Donut.<anonymous> (/usr/local/lib/node_modules/gtop/node_modules/blessed-contrib/lib/widget/canvas.js:22:29)
    at Donut.EventEmitter._emit (/usr/local/lib/node_modules/gtop/node_modules/blessed/lib/events.js:98:20)
    at Donut.EventEmitter.emit (/usr/local/lib/node_modules/gtop/node_modules/blessed/lib/events.js:117:12)
    at emit (/usr/local/lib/node_modules/gtop/node_modules/blessed/lib/widgets/node.js:109:15)
    at Screen.Node.insert (/usr/local/lib/node_modules/gtop/node_modules/blessed/lib/widgets/node.js:111:5)
aksakalli commented 7 years ago

Duplicate of #28, closing

montanaflynn commented 7 years ago

I'm not using Webstorm terminal. That issue is also closed but is not resolved.

aksakalli commented 7 years ago

hi @montanaflynn ,

Which terminal emulator are you using on your macOS?

montanaflynn commented 7 years ago

iTerm2

guyskk commented 7 years ago

I meet the same error, my terminal is Tilda 1.3.3:

➜  ~ gtop
RangeError: "size" argument must not be negative
    at Function.Buffer.alloc (buffer.js:229:3)
    at new Buffer (buffer.js:152:19)
    at new Canvas (/usr/lib/node_modules/gtop/node_modules/drawille-blessed-contrib/index.js:17:18)
    at new Context (/usr/lib/node_modules/gtop/node_modules/drawille-canvas-blessed-contrib/index.js:11:18)
    at module.exports.Canvas.getContext (/usr/lib/node_modules/gtop/node_modules/drawille-canvas-blessed-contrib/index.js:274:24)
    at Donut.<anonymous> (/usr/lib/node_modules/gtop/node_modules/blessed-contrib/lib/widget/canvas.js:22:29)
    at Donut.EventEmitter._emit (/usr/lib/node_modules/gtop/node_modules/blessed/lib/events.js:98:20)
    at Donut.EventEmitter.emit (/usr/lib/node_modules/gtop/node_modules/blessed/lib/events.js:117:12)
    at emit (/usr/lib/node_modules/gtop/node_modules/blessed/lib/widgets/node.js:109:15)
    at Screen.Node.insert (/usr/lib/node_modules/gtop/node_modules/blessed/lib/widgets/node.js:111:5)
➜  ~ node --debug /usr/bin/gtop  
(node:27000) [DEP0062] DeprecationWarning: `node --debug` and `node --debug-brk` are invalid. Please use `node --inspect` or `node --inspect-brk` instead.
➜  ~ node --inspect /usr/bin/gtop
Debugger listening on ws://127.0.0.1:9229/90ec5b9d-ae42-4f5e-8b12-b9d0948aaaef
For help see https://nodejs.org/en/docs/inspector
RangeError: "size" argument must not be negative
    at Function.Buffer.alloc (buffer.js:229:3)
    at new Buffer (buffer.js:152:19)
    at new Canvas (/usr/lib/node_modules/gtop/node_modules/drawille-blessed-contrib/index.js:17:18)
    at new Context (/usr/lib/node_modules/gtop/node_modules/drawille-canvas-blessed-contrib/index.js:11:18)
    at module.exports.Canvas.getContext (/usr/lib/node_modules/gtop/node_modules/drawille-canvas-blessed-contrib/index.js:274:24)
    at Donut.<anonymous> (/usr/lib/node_modules/gtop/node_modules/blessed-contrib/lib/widget/canvas.js:22:29)
    at Donut.EventEmitter._emit (/usr/lib/node_modules/gtop/node_modules/blessed/lib/events.js:98:20)
    at Donut.EventEmitter.emit (/usr/lib/node_modules/gtop/node_modules/blessed/lib/events.js:117:12)
    at emit (/usr/lib/node_modules/gtop/node_modules/blessed/lib/widgets/node.js:109:15)
    at Screen.Node.insert (/usr/lib/node_modules/gtop/node_modules/blessed/lib/widgets/node.js:111:5)
➜  ~ 

System Info:

➜  ~ screenfetch 
                   -`                 
                  .o+`                 guyskk@archlinux
                 `ooo/                 OS: Arch Linux 
                `+oooo:                Kernel: x86_64 Linux 4.12.13-1-ARCH
               `+oooooo:               Uptime: 3d 18h 1m
               -+oooooo+:              Packages: 1369
             `/:-:++oooo+:             Shell: zsh 5.4.2
            `/++++/+++++++:            Resolution: 3840x1080
           `/++++++++++++++:           DE: GNOME 
          `/+++ooooooooooooo/`         WM: GNOME Shell
         ./ooosssso++osssssso+`        WM Theme: 
        .oossssso-````/ossssss+`       GTK Theme: Adwaita [GTK2/3]
       -osssssso.      :ssssssso.      Icon Theme: Adwaita
      :osssssss/        osssso+++.     Font: Cantarell 11
     /ossssssss/        +ssssooo/-     CPU: Intel Core i5-6200U @ 4x 2.8GHz [63.0°C]
   `/ossssso+/:-        -:/+osssso+-   GPU: intel
  `+sso+:-`                 `.-/+oso:  RAM: 5826MiB / 7883MiB
 `++:.                           `-/+/
 .`                                 `/
aksakalli commented 7 years ago

it is due to terminal size.

The dashboard constructor throws this exception when the character size is very small to draw. It is required to have a better error handling, I guess...