Skip to content

Conversation

@stroncium
Copy link
Contributor

@stroncium stroncium commented May 3, 2019

Add consumeStdin option, fixes #97

Though I have no idea how to write tests for it.

Plus, if some other library decides to something like what we do here, but won't be as careful as we are, things might get ugly. But that's mostly limitation of node's way of handling things.

@sindresorhus
Copy link
Owner

I don't feel that consumeStdin perfectly describes what it does. It reads as if we actually use the stdin for something. How about something like swallowStdin, or something even clearer? Ideas?

@stroncium
Copy link
Contributor Author

Well, I don't see much difference between swallow and consume to be honest. >_<

But generally I have no better idea than consume, as it is the word usually used to describe that behavior towards terminal inputs.

@GuillaumeRochat
Copy link

I don't feel that consumeStdin perfectly describes what it does. It reads as if we actually use the stdin for something. How about something like swallowStdin, or something even clearer? Ideas?

Would something along the line of discardStdin be clearer? Searching the web for discard stdin got me some relevant results

@sindresorhus
Copy link
Owner

sindresorhus commented Jun 21, 2019

I think ignoreStdin would be a better option name from a user perspective. (discardStdin could work too)

@sindresorhus
Copy link
Owner

Though I have no idea how to write tests for it.

You could add a manual test, like https://github.com/sindresorhus/ora/blob/master/example.js, so we can manually verify that it ignores Enter etc, and correctly resets stdin back to normal when being stopped.

@stroncium
Copy link
Contributor Author

@sindresorhus added to example.js

@stroncium
Copy link
Contributor Author

stroncium commented Jun 28, 2019

Changed the name to discardStdin (ignoreStdin still feels weird, as it is actually ignored if the option is false).

@stroncium
Copy link
Contributor Author

@sindresorhus Shouldn't we set this behavior as default, by the way? There is almost no cases when people wouldn't wan't it to be this way, I imagine.

@sindresorhus
Copy link
Owner

Shouldn't we set this behavior as default, by the way?

👍

@sindresorhus sindresorhus changed the title Add consumeStdin option, fixes #97 Discard stdin by default Jul 5, 2019
@sindresorhus sindresorhus merged commit b1f140b into sindresorhus:master Sep 22, 2019
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

Successfully merging this pull request may close these issues.

Swallow input when spinning?

3 participants