Zane Hitchcox
Zane Hitchcox

Reputation: 936

Why isn't concat-stream working with process.stdin.pipe()?

Here's my code:

var concat = require('concat-stream');
process.stdin.pipe(concat(function(){console.log("output")}));

What I'm expecting this to do is output "output" every time I enter input into the console, but this doesn't work. Does anyone have an idea why this isn't working? If I do a fs.createReadStream() buffer, it works fine, just not with process.stdin.pipe(). I've used process.stdin.pipe() for other things though, and they worked fine.

Thanks in advance!

Upvotes: 5

Views: 915

Answers (1)

mscdex
mscdex

Reputation: 106698

The reason you get no output is because you're not actually closing stdin, which is what concat-stream is looking for so that it knows no more data is coming.

Upvotes: 3

Related Questions