[Issue 18309] std.process.pipeProcess should warn if the buffer is full

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Jan 28 18:52:53 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=18309

Steven Schveighoffer <schveiguy at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy at yahoo.com

--- Comment #1 from Steven Schveighoffer <schveiguy at yahoo.com> ---
What is the suggestion here? That tryWait should tell you the read buffer is
full? Or that there be a mechanism to check for buffer being full?

I know that pipes can be unintuitive if you haven't set up your ends properly.
There are all kinds of cases where you may have a race condition.

The sample above, and the solution you suggest, are both counter-intuitive to
me. IMO, the solution is not to worry about the process ending until after
you've exhausted the data stream.

In any case, I'm inclined to say that we aren't going to solve this problem by
adding any warnings. In fact, I'd discourage having any kind of code based on
the buffer being full, as your code, if written correctly, should be pretty
immune to buffer sizes.

Piling on top of that -- the pipe itself is abstracted behind a File, which is
*also* buffered. extracting meaningful info about the OS's pipe buffer may be a
lost cause.

A solution documentation-wise would be to show that pipes are in fact subject
to race conditions, and you need to be careful how you code them.

--


More information about the Digitalmars-d-bugs mailing list