Commit aa088ebe authored by Alexey Spiridonov's avatar Alexey Spiridonov Committed by Facebook Github Bot 0

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
parent 007d2a6b
......@@ -108,6 +108,7 @@
#include <boost/container/flat_map.hpp>
#include <boost/operators.hpp>
#include <folly/Exception.h>
#include <folly/File.h>
#include <folly/FileUtil.h>
#include <folly/gen/String.h>
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment