unhandled ECONNRESET when using head #18

pigulla opened this Issue Jun 30, 2013 · 0 comments

1 participant


I'm trying to use head to only get the first n bytes of output. See the following (contrived) example:

var procstream = require('procstreams');

procstream('cat', ['/dev/random'])
    .pipe('head', ['--bytes=100'])
    .data(function (err, stdout, stderr) {
        console.log(stdout.length + ' bytes read');

When that code is run, I get an unhandled error event:

        throw er; // Unhandled 'error' event
Error: read ECONNRESET
    at errnoException (net.js:901:11)
    at Pipe.onread (net.js:556:19)

I'm not much of a Linux shell guy but I assume head just closes the stream when enough data was read. It would be nice if procstream could handle these kinds of situations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment