json-viewer icon indicating copy to clipboard operation
json-viewer copied to clipboard

Error with redirecting from json to less command

Open TheBestTvarynka opened this issue 5 years ago • 2 comments

I like to use this command with less because in this way my terminal continues to stay pure. Something like this: json my_file.json | less. When I am scrolling all works well. But when I quit I have got next error:

events.js:292
      throw er; // Unhandled 'error' event
      ^

Error: write EPIPE
    at WriteWrap.onWriteComplete [as oncomplete] (internal/stream_base_commons.js:92:16)
Emitted 'error' event on Socket instance at:
    at errorOrDestroy (internal/streams/destroy.js:128:12)
    at onwriteError (_stream_writable.js:406:3)
    at onwrite (_stream_writable.js:427:7)
    at internal/streams/destroy.js:60:7
    at Socket.dummyDestroy [as _destroy] (internal/bootstrap/switches/is_main_thread.js:97:3)
    at Socket.destroy (internal/streams/destroy.js:55:8)
    at WriteWrap.onWriteComplete [as oncomplete] (internal/stream_base_commons.js:93:12) {
  errno: -32,
  code: 'EPIPE',
  syscall: 'write'
}

TheBestTvarynka avatar Apr 20 '20 20:04 TheBestTvarynka

Also, when I redirect output that takes less that one screen to less command all ended without errors.

TheBestTvarynka avatar Apr 21 '20 21:04 TheBestTvarynka

It may be something regarding this Promise https://github.com/mjurczyk/json-viewer/blob/develop/src/utils/cli/get-cli-input.js#L23 Seems reject is thrown but never handled. I will take a look.

mjurczyk avatar Apr 23 '20 07:04 mjurczyk