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: write EPIPE #9

Open
Miyou opened this issue Sep 22, 2020 · 1 comment
Open

Error: write EPIPE #9

Miyou opened this issue Sep 22, 2020 · 1 comment

Comments

@Miyou
Copy link

Miyou commented Sep 22, 2020

Hi. I just tried using the package, and it works great when I supply a string of a filename, but as soon as I pass in a stream it crashes the process with the above error.
Here's a minimum reproducible example:

fpcalc(fs.createReadStream('rickroll.webm'), function (err, result) {
  if (err) {
    console.log('error!', err);
  }
  console.log(result.file, result.duration, result.fingerprint);
});

The full error is:

Error: write EPIPE
    at WriteWrap.onWriteComplete [as oncomplete] (internal/stream_base_commons.js:92:16)
error Command failed with exit code 1.

Any ideas on how to fix this?

@Miyou
Copy link
Author

Miyou commented Sep 22, 2020

So I changed line 81 in index.js from options.stdin.pipe(cp.stdin); to:

options.stdin.pipe(cp.stdin).on('error', (err) => {
	if (err.code === 'EPIPE') return;
	else throw err;
});

and it works now. Not sure if that's a good solution though or if there is something causing the error that we should fix? Would be great if someone who knows more about this type of error could weigh in.

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

1 participant