[Issue 11282] std.process: add capability for two-way inter-process communication without deadlock

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Oct 16 16:25:13 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=11282


Hans Fugal <hans at fugal.net> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |hans at fugal.net


--- Comment #3 from Hans Fugal <hans at fugal.net> 2013-10-16 16:25:10 PDT ---
Hi Brad, the idea is to have something like python's
subprocess.Popen.communicate() which (conceptually) writes a string to the
subprocess's stdin, and then reads from its stdout and stderr until EOF. This
must be implemented with alternating event-driven writes and reads (i.e. using
select() - different threads would work but it's unnecessary overhead), to
avoid the pipe deadlock that you can get when you try to write everything and
then read everything.

This is a common pattern that is I think worth making easy. It is not the only
pattern, sometimes you need more control and stdin isn't known up-front, you
need parallelism and pipelining, etc. But it greatly simplifies the cases where
it applies.

1.
http://docs.python.org/2/library/subprocess.html#subprocess.Popen.communicate

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list