]> git.saurik.com Git - wxWidgets.git/commitdiff
fix a hang up in wxExecute(wxArrayString& output) overload (#4380)
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 30 Jun 2008 23:37:56 +0000 (23:37 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 30 Jun 2008 23:37:56 +0000 (23:37 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@54439 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/msw/utilsexc.cpp

index 515d506d6302fbccb283a4829c3b01237544f648..60fb2164e59e7d51783bc528d50c581dba58da35 100644 (file)
@@ -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;