Open mattmccarty opened 6 years ago
@mattmccarty: My bet is that we're going to want to make unsafe
blocks more granular than you have, but we can handle that when we actually try to land this. :)
Another question: how does this compare to the get_tty
that @mcgoo implemented before and that I had to rebase? I unfortunately have little domain knowledge with the terminal APIs exposed by Windows. I know where to find them, but it's hard to know when I might actually need something...
@ErichDonGubler Regarding the unsafe blocks, I'll trust your rust knowledge. I'm new to rust, so I have some learning to do.
Regarding your second question, it's hard for me to recall because I did the research back in December and put this together. I believe that by getting the stream using "CONIN$" with CreateFile will return the actual console regardless if the stream has been redirected.
Btw, I feel your pain. I'm not an expert Windows guy either. I typically use linux. I made the switch from developing for Windows to linux (and the web) about 10 years ago. I've got some catching up to do.
I've started working on this in the windows-is_tty
branch (which should probably be renamed to something like windows-tty
). Your implementation of the is_tty
looks like it works -- looking forward to getting get_tty
working with you! :)
get_tty() is now working at least with ConEmu. cmd.exe panics and throws an error when a key is pressed. I will fix that next.
This is the backbone of the asyncronise portion of the code base, so I think we should implement this first. I have put together a draft which is included below. I'm new to rust, so we need to figure out the best way to return the data.
The function that consumes the returned data is async::async_stdin.