Skip to content

stop showing EPIPE#9

Merged
zpoley merged 1 commit into
zpoley:masterfrom
tricknotes:stop-showing-epipe
May 29, 2012
Merged

stop showing EPIPE#9
zpoley merged 1 commit into
zpoley:masterfrom
tricknotes:stop-showing-epipe

Conversation

@tricknotes

Copy link
Copy Markdown
Contributor

json-command is a nice tool!
Whenever I parse json, I use this awesome product.

But the following error occurred, when I give large buffer and use pager:

$ node --version
v0.6.18
$ pwd
~/json_command
$ seq 1 10000 | ./bin/json.js | less

And close pager without reading all buffer:

events.js:48
        throw arguments[1]; // Unhandled 'error' event
                       ^
Error: write EPIPE
    at errnoException (net.js:670:11)
    at Object.afterWrite [as oncomplete] (net.js:503:19)

The reason why this error occurred, process.stdout.write throw error EPIPE when the pager(such as less, lv) closed before reading all buffer.

I think that this case should not throw error.
Therefor, I stopped showing this error in the way to ignore EPIPE.

I tested my patch in the following node versions:

v0.4.12
v0.6.18
v0.7.8

@tricknotes

Copy link
Copy Markdown
Contributor Author

This patch maybe fixes #5.
I replicated the error of #5 using node v0.4.12.

$ node --version
v0.4.12
$ pwd
~/json_command
$ seq 1 10000 | ./bin/json.js | less

And exit pager:

node.js:134
        throw e; // process.nextTick error, or 'error' event on first tick
        ^
Error: EPIPE, Broken pipe
    at Socket._writeImpl (net.js:159:14)
    at Socket._writeOut (net.js:444:25)
    at Socket.write (net.js:377:17)
    at [object Object].processObjects (/Users/rsato/Documents/dev/json-command/lib/jsonCommand.js:394:24)
    at Socket.<anonymous> (/Users/rsato/Documents/dev/json-command/lib/jsonCommand.js:451:40)
    at Socket.emit (events.js:64:17)
    at Socket._onReadable (net.js:667:31)
    at IOWatcher.onReadable [as callback] (net.js:177:10)

When this patch applied, this error is not occurred.

zpoley added a commit that referenced this pull request May 29, 2012
@zpoley zpoley merged commit 056fc2d into zpoley:master May 29, 2012
@tricknotes

Copy link
Copy Markdown
Contributor Author

Thanks for your merging ❤️

@zpoley

zpoley commented May 29, 2012

Copy link
Copy Markdown
Owner

Thanks tricknotes! Great work. Merged and published in json@0.0.11.

@tricknotes

Copy link
Copy Markdown
Contributor Author

I'll install immediately 😄

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.

2 participants