Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error are not triggered #54

Open
leecjson opened this issue Apr 4, 2020 · 2 comments
Open

Error are not triggered #54

leecjson opened this issue Apr 4, 2020 · 2 comments

Comments

@leecjson
Copy link

leecjson commented Apr 4, 2020

Please see 'end-of-stream' module's second param options,

eos(stream, {readable: reading, writable: writing}, function (err) {
    if (err) return callback(err)
    closed = true
    callback()
  })

can you change the codes to

eos(stream, {readable: reading, writable: writing, error: true}, function (err) {
    if (err) return callback(err)
    closed = true
    callback()
  })
@mafintosh
Copy link
Owner

I’m not sure what you are asking about. Can you clarify?

@leecjson
Copy link
Author

leecjson commented Apr 5, 2020

pump(
      tar.create({
        zlib: { level: 9 },
        cwd: output,
      }, fs.readdirSync(output)),
      req,
      (err) => {
        if (err) {
          reject(err);
        }
      });

The codes above will not reject when 'req' (which req is a http.request) emit a 'hang up error', So i have to change the codes to

tarStream
      .on('error', e => {
        req.destroy();
        reject(e);
      })
      .pipe(req)
      .on('error', e => {
        tarStream.destroy();
        reject(e);
      });

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

No branches or pull requests

2 participants