www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 18309] New: std.process.pipeProcess should warn if the buffer


          Issue ID: 18309
           Summary: std.process.pipeProcess should warn if the buffer is
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: major
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: greensunny12 gmail.com

This program never terminates:

void main(string[] args)
    import std.process, std.stdio;
    auto pipes = pipeProcess(["seq", "13000"], Redirect.stdout); // set me to
12k to work
    while(true) {
                auto res = tryWait(pipes.pid);
                if (res.terminated) break;
    foreach (c; pipes.stdout.byChunk(100)) {
        writeln(cast(string) c);

This is due to pipe's buffer (PIPE_BUF) being exceeded.


Of course, the solution is to read from the pipe in the loop, but I feel like
this is still something that's very easy to run into.

Not sure whether that's something that can/should be done by the library code,
or it should simply be documented better.

Jan 26 2018