Is there a way to read the current raw options for stdin?
I want to create an operation that uses raw input from stdin, but then resets it afterwards to whatever it was when the operation started. In other words, if it was already raw, then it should remain raw. If it was not, then it should be reset to be not raw. The same applies for the value of the raw options: e.g.
{cbreak: true }
In order to do this, I need to read the current raw options. Is there a way to do this?5 Replies
I don't fully understand your question, but hopefully this helps: https://docs.deno.com/api/deno/~/Deno.stdin
Deno
Deno.stdin - Deno - Deno Docs
In-depth documentation, guides, and reference materials for building secure, high-performance JavaScript and TypeScript applications with Deno
@Leokuma I want to set raw to true, do some stuff, and then set raw back to whatever its configuration was. Does that make sense?
It sounds like this can't be done?
Sorry, I forgot to answer
I think there's no way to get the current state of stdin. You'll have to store the previous options somehow and then reassign them with
setRaw()
So if setRaw was false
before, you reassign it to false: setRaw(false, options)
But you could open an issue asking for a native way to retrieve that@Leokuma right. Without a way to get the options, there is no way to set them back to what they were, hence my question.
I can file an issue.
GitHub
Ability to read the current stdin raw options so that setRaw() can ...
I want to create an operation that uses raw input from stdin, but then resets it afterwards to whatever it was when the operation started. In other words, if it was already raw, then it should rema...