On Thu, 15 Oct 2015 11:18:52 GMT, Sönke Ludwig wrote:
StdFileStream
is now part of vibe.d: http://vibed.org/api/vibe.stream.stdio/StdFileStreamI'm not 100% sure if this is fully compatible with the
PipedProcess
implementation, but I guess so, because I haven't changed anything in that area for quite a while.
Okay, it seems to compile, but now my code hangs and I'm not sure what to do about it:
PipedProcess p = new PipedProcess("clang-format", ["-style="~style]);
p.stdin.write(code);
code = "";
for(ulong toRead = 0; toRead > 0 || p.stdout.connected; toRead = p.stdout.leastSize){
ubyte[] buf = new ubyte[toRead];
p.stdout.read(buf);
code ~= buf;
}
My previous code: (unfortunately, it caused the whole app to hang sometimes)
auto pipes = pipeProcess(["clang-format", "-style="~style], Redirect.stdout | Redirect.stdin);
scope(exit) wait(pipes.pid);
pipes.stdin.write(code);
pipes.stdin.close;
pipes.pid.wait;
code = pipes.stdout.byLine.joiner.to!string;