For sure indeed! winapi allows the capture of interactive processes:On Thu, Apr 11, 2013 at 3:52 AM, oliver <email@example.com> wrote:
Very useful for sure. Is there anything like this on Windows? Python's subprocess module allows to feed a process's stdin and read its stdout and stderr independent of OS platform.
If you use read_async that calls a callback with each received chunk, then you can capture multiple such processes in parallel.The Unix concept of 'pseudo terminals' (ptys) is most elegant - you arrange the process to run in a pty, and then control the properties of that pty as if it were a 'real' terminal connected e.g. to a serial connection. So you can arrange to buffer by line, etc. Whereas with the Windows CreateProcess method used by winapi, the received data won't generally be single lines, and stitching them together is up to you.
I've occaisionally thought it would be cool to have a cross-platform module which provided these useful OS features in a high-level way, rather like that Python module. The implementation would use winapi, luaposix or Justin Cormark's ljsyscall for LuaJIT.