Skip to content

unhandled ECONNRESET when using head #18

@pigulla

Description

@pigulla

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:

events.js:72
        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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions