From: Alexey Spiridonov Date: Wed, 20 Apr 2016 19:08:29 +0000 (-0700) Subject: Throw on errors in read callback X-Git-Tag: 2016.07.26~340 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=aa088ebef6319194a0a762bc16629d5187ec2f00;p=folly.git Throw on errors in read callback Summary: Before this fix, the callback would silently ignore `ret == -1` if the error isn't `EAGAIN`. Reviewed By: spacedentist Differential Revision: D3193845 fb-gh-sync-id: e4a7aa37de7dab8ebe0633dd9888d8adc11dd1c2 fbshipit-source-id: e4a7aa37de7dab8ebe0633dd9888d8adc11dd1c2 --- diff --git a/folly/Subprocess.h b/folly/Subprocess.h index c70a1f4b..2b6cbffc 100644 --- a/folly/Subprocess.h +++ b/folly/Subprocess.h @@ -108,6 +108,7 @@ #include #include +#include #include #include #include @@ -683,6 +684,7 @@ class Subprocess { if (ret == -1 && errno == EAGAIN) { // No more data for now return false; } + checkUnixError(ret, "read"); if (ret == 0) { // Reached end-of-file splitter.flush(); // Ignore return since the file is over anyway return true;