sindresorhus / get-stdin

Get stdin as a string or buffer
MIT License
337 stars 28 forks source link

Add TTY support. Fix getStdin.buffer() and tests. #11

Closed moos closed 8 years ago

moos commented 8 years ago

This implements TTY support per issue #1.

It also fixes the original tests by clearing listeners before each test, and fixing the Promise test for getStdin.buffer() where the assertions were never being called.

With the test fixed, getStdin.buffer() was returning:

  TypeError: buf.copy is not a function
    at ReadStream.<anonymous> (D:\dev\github\get-stdin\index.js:56:19)
    at Test.fn (D:\dev\github\get-stdin\test.js:36:16)

So fixed this as well, with line 46 in index.js by forcing a new Buffer();

I can submit separate PRs if you prefer -- trying to save myself the hassle of cheery-picking or creating a separate branch!

moos commented 8 years ago

I think the Travis build with Node 0.12 is unrelated. Can you Kick-off another build?

sindresorhus commented 8 years ago

After a lot of thought, I've decided to pass on this. It's just something I would never use and I've honestly never even seen it used. I'd like to preserve the simplicity of this module. I'd suggest you fork and make your own more advanced version of it ;)

moos commented 8 years ago

You've never seen "cat > foo" ?

Fair enough, but you many want to consider changing your package name to something like get-stdin-pipe, or update the readme with the limitation that it only reads from pipes.