summaryrefslogtreecommitdiffstats
path: root/src/subprocess-win32.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/subprocess-win32.cc')
-rw-r--r--src/subprocess-win32.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/subprocess-win32.cc b/src/subprocess-win32.cc
index 6b7e942..fef0bc8 100644
--- a/src/subprocess-win32.cc
+++ b/src/subprocess-win32.cc
@@ -28,7 +28,7 @@ void Win32Fatal(const char* function) {
} // anonymous namespace
-Subprocess::Subprocess() : child_(NULL) , overlapped_() {
+Subprocess::Subprocess() : child_(NULL) , overlapped_(), is_reading_(false) {
}
Subprocess::~Subprocess() {
@@ -134,10 +134,11 @@ void Subprocess::OnPipeReady() {
Win32Fatal("GetOverlappedResult");
}
- if (bytes)
+ if (is_reading_ && bytes)
buf_.append(overlapped_buf_, bytes);
memset(&overlapped_, 0, sizeof(overlapped_));
+ is_reading_ = true;
if (!::ReadFile(pipe_, overlapped_buf_, sizeof(overlapped_buf_),
&bytes, &overlapped_)) {
if (GetLastError() == ERROR_BROKEN_PIPE) {