rework the Subprocess::communicate() API
authorAdam Simpkins <simpkins@fb.com>
Thu, 16 May 2013 02:03:40 +0000 (19:03 -0700)
committerJordan DeLong <jdelong@fb.com>
Wed, 26 Jun 2013 02:45:53 +0000 (19:45 -0700)
commit76ade9184fe7702e0e6547e0bd3553f810304b59
treeadde3297e0ea5c32fa2af7c01332f8cd768ad1a5
parent16d227a14ccecc4fe2655750368e4e482d80485e
rework the Subprocess::communicate() API

Summary:
This eliminates the CommunicateFlags argument to communicate().  It now
always reads from both stdout and stderr if they were set up a pipes.
If a non-empty input buffer was supplied, it always writes that to
stdin.

This mimics the communicate() behavior of python's subprocess.py module.
This also makes it impossible to have buffering deadlocks by forgetting
to call communicate() with readStderr().

Test Plan:
Ran the existing subprocess tests, and also added a more complicated
duplex test that requires communication on stdin, stdout, and stderr all
at the same time.

Also grepped for all existing users of Subprocess::communicate(), and
made sure they will work correctly with the new behavior.

Reviewed By: tudorb@fb.com

FB internal diff: D814405
folly/Subprocess.cpp
folly/Subprocess.h
folly/io/IOBufQueue.h
folly/test/SubprocessTest.cpp