Fix Chatty subprocess test, call callback on hangup
authorTudor Bosman <tudorb@fb.com>
Wed, 30 Apr 2014 00:40:42 +0000 (17:40 -0700)
committerDave Watson <davejwatson@fb.com>
Tue, 20 May 2014 19:53:56 +0000 (12:53 -0700)
commit6b20f11e8c85252e856aeb06dc89d53f5b66c59c
tree5b1b72b617807cdfe9ddfd7f43598891c1b21f22
parent309fa7e7877add5de7ab1d995c33b569f6545951
Fix Chatty subprocess test, call callback on hangup

Summary:
The Chatty subprocess test incorrectly assumed that we saw EOF on the last
read from the child (that is, read() returned 0). That's not the case for two
reasons: 1. the child is allowed to stall right before it closes its stdout, in
which case we get EAGAIN, and 2. Subprocess::communicate would close the fd
without calling the read callback anyway. Fix both such things.

Test Plan: ran test

Reviewed By: njormrod@fb.com

FB internal diff: D1303215
folly/Subprocess.cpp
folly/test/SubprocessTest.cpp