Hi, On Thursday, July 31, 2014 12:13:31 AM UTC+2, Thiago Arruda wrote:
I'm giving up on this, mainly because Windows has nothing equivalent to > pseudo terminals and it seems to be impossible to achieve something similar > with conventional API call. It's not surprising that there aren't many > custom terminal emulators for Windows out there. > > With that said, I found a way achieve some level of terminal emulation on > Windows after reading parts of Console2 source code: > http://sourceforge.net/projects/console/ > > The idea is fairly simple: Besides the executable, Console2 also builds a > dll that is injected into the child process running in a new hidden console > created with CREATE_NEW_CONSOLE(actually, what is injected is a call to > LoadLibrary passing the dll path). This dll creates a thread to watch for > changes in 'CONOUT$' (which is the console screen buffer) and send updates > with the parent Console2 process through shared memory. Likewise, it will > watch shared memory for input coming from Console2, and forward it to > 'CONIN$' which is the console input buffer. > > To avoid requiring an extra dll to be shipped, one could use MemoryModule( > https://github.com/fancycode/MemoryModule) to inject an embedded dll, but > that would be too hacky for a library like libuv > Windows has very little terminal emulation support but the basics of starting a console program and redirecting it standard input / output are there and possible without any DLL injection hacks. I've done it in a past project of mine called winpexpect See the link here: https://bitbucket.org/geertj/winpexpect (there's also a repo on Github with the same name but that's an abandoned WIP - don't use it) The builtin support won't allow you to build a decent terminal emulator but it does allow you to automate most command-line programs including cmd.exe and powershell. Out of curiosity what do you require in addition to this? I would love to see PTY support in uv_process, but I think it will have to be a Unix specific flag. Regards, Geert -- You received this message because you are subscribed to the Google Groups "libuv" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/libuv. For more options, visit https://groups.google.com/d/optout.
