From: Vadim Zeitlin Date: Mon, 30 Jun 2008 23:37:56 +0000 (+0000) Subject: fix a hang up in wxExecute(wxArrayString& output) overload (#4380) X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/386a2898e3a55362d30d22adf024b95ce0d5773f fix a hang up in wxExecute(wxArrayString& output) overload (#4380) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54439 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/msw/utilsexc.cpp b/src/msw/utilsexc.cpp index 515d506d63..60fb2164e5 100644 --- a/src/msw/utilsexc.cpp +++ b/src/msw/utilsexc.cpp @@ -433,8 +433,19 @@ wxPipeInputStream::~wxPipeInputStream() bool wxPipeInputStream::CanRead() const { + // we can read if there's something in the put back buffer + // even pipe is closed + if ( m_wbacksize > m_wbackcur ) + return true; + + wxPipeInputStream * const self = wxConstCast(this, wxPipeInputStream); + if ( !IsOpened() ) + { + // set back to mark Eof as it may have been unset by Ungetch() + self->m_lasterror = wxSTREAM_EOF; return false; + } DWORD nAvailable; @@ -460,8 +471,6 @@ bool wxPipeInputStream::CanRead() const // it had been closed ::CloseHandle(m_hInput); - wxPipeInputStream *self = wxConstCast(this, wxPipeInputStream); - self->m_hInput = INVALID_HANDLE_VALUE; self->m_lasterror = wxSTREAM_EOF;