May 10, 2015
On Saturday, 9 May 2015 at 13:00:01 UTC, wobbles wrote:
> Just as an example of running cmd through std.process, running this on my system:
> 	auto pipes = pipeShell("cmd.exe");
> 	write(pipes.stdout.readln);
> 	write(pipes.stdout.readln);
> 	write(pipes.stdout.readln);
>         return;
> will print
> `
> Microsoft Windows [Version 6.3.9600]
> (c) 2013 Microsoft Corporation. All rights reserved.
>
> `
> and then exits.
>
> However, adding another "write" line before the return; will cause the program to hang there, waiting for the cmd.exe process to flush it's next line.

I guess, the last (prompt) line is properly flushed, it just doesn't have EOL, that's why readln won't return it. See if stdout has a method to read/peek whatever data it has without waiting for EOL.
May 10, 2015
On Saturday, 9 May 2015 at 13:00:01 UTC, wobbles wrote:
> My windows knowledge isnt marvelous, but I believe I'll need the interpreter attached.

If you only need the interpreter, pipeProcess should be fine, it's a normal program like anything else, just interactive.
May 11, 2015
On Saturday, 9 May 2015 at 23:32:49 UTC, Adam D. Ruppe wrote:
> On Saturday, 9 May 2015 at 13:00:01 UTC, wobbles wrote:
>> On Linux, I'm able to edit a file descriptor after I've created it to tell it to read/write asynchronously, I cant seem to find anything similar on windows however.
>
> Asynchronous I/O on Windows is called "Overlapped I/O". It is a bit involved to use though, especially since D by default doesn't come with all the necessary headers. You can download the win32 api bindings or you can just declare the bits as needed.
>
> My terminal emulator uses overlapped I/O and a spawned process (and on Linux, it uses forkpty!) to talk to ssh on Windows.
>
> https://github.com/adamdruppe/terminal-emulator/blob/master/terminalemulator.d
>
> I had to write a function to make an async pipe, then spawn a process using them, then get and send data. I also declared all the needed functions myself.
>
> A lot of code to go through but it is a working example... a few things to look for are MyCreatePipeEx, CreateProcess, the word 'overlapped', ReadFileEx, and the simpledisplay.d library it imports also uses SleepEx which lets other things trigger.

Thanks adam, this is very helpful!
1 2
Next ›   Last »