+
+// ----------------------------------------------------------------------------
+// MyPipedProcess
+// ----------------------------------------------------------------------------
+
+bool MyPipedProcess::HasInput()
+{
+ bool hasInput = FALSE;
+
+ wxInputStream& is = *GetInputStream();
+ if ( !is.Eof() )
+ {
+ wxTextInputStream tis(is);
+
+ // this assumes that the output is always line buffered
+ wxString msg;
+ msg << m_cmd << _T(" (stdout): ") << tis.ReadLine();
+
+ m_parent->GetLogListBox()->Append(msg);
+
+ hasInput = TRUE;
+ }
+
+ wxInputStream& es = *GetErrorStream();
+ if ( !es.Eof() )
+ {
+ wxTextInputStream tis(es);
+
+ // this assumes that the output is always line buffered
+ wxString msg;
+ msg << m_cmd << _T(" (stderr): ") << tis.ReadLine();
+
+ m_parent->GetLogListBox()->Append(msg);
+
+ hasInput = TRUE;
+ }
+
+ return hasInput;
+}
+
+void MyPipedProcess::OnTerminate(int pid, int status)
+{
+ // show the rest of the output
+ while ( HasInput() )
+ ;
+
+ m_parent->OnProcessTerminated(this);
+
+ MyProcess::OnTerminate(pid, status);
+}
+
+// ----------------------------------------------------------------------------
+// MyPipedProcess2
+// ----------------------------------------------------------------------------
+
+bool MyPipedProcess2::HasInput()
+{
+ if ( !!m_input )
+ {
+ wxTextOutputStream os(*GetOutputStream());
+ os.WriteString(m_input);
+
+ CloseOutput();
+ m_input.clear();
+
+ // call us once again - may be we'll have output
+ return TRUE;
+ }
+
+ return MyPipedProcess::HasInput();
+}