]> git.saurik.com Git - wxWidgets.git/blobdiff - src/msw/utilsexc.cpp
Enable the correct code making sure that subwindows will always receive a wxSizeEvent...
[wxWidgets.git] / src / msw / utilsexc.cpp
index 515d506d6302fbccb283a4829c3b01237544f648..f67e0eb11d9cf3024b5b7e6f2c9f2f5c1b200dd1 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;
 
@@ -1018,9 +1027,34 @@ long wxExecuteImpl(CharType **argv, int flags, wxProcess *handler)
     wxString command;
     command.reserve(1024);
 
+    wxString arg;
     for ( ;; )
     {
-        command += *argv++;
+        arg = *argv++;
+
+        bool quote;
+        if ( arg.empty() )
+        {
+            // we need to quote empty arguments, otherwise they'd just
+            // disappear
+            quote = true;
+        }
+        else // non-empty
+        {
+            // escape any quotes present in the string to avoid interfering
+            // with the command line parsing in the child process
+            arg.Replace("\"", "\\\"", true /* replace all */);
+
+            // and quote any arguments containing the spaces to prevent them from
+            // being broken down
+            quote = arg.find_first_of(" \t") != wxString::npos;
+        }
+
+        if ( quote )
+            command += '\"' + arg + '\"';
+        else
+            command += arg;
+
         if ( !*argv )
             break;