1. stderr redirection seems to work under Windows too (documented new

wxProcess method too)
2. don't show the window of the (console) process in wxExecute if IO is
   redirected
3. implemented wxColourDialog::SetTitle
4. implemented wxGauge95::SetForeground/BackgroundColour()


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_2_BRANCH@7491 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2000-05-25 21:54:23 +00:00
parent 54d5ffd6c3
commit 31fb9a5779
11 changed files with 273 additions and 92 deletions

View File

@@ -1208,12 +1208,18 @@ wxString wxGetCurrentDir()
// wxExecute
// ----------------------------------------------------------------------------
long wxExecute(const wxString& command, wxArrayString& output)
// this is a private function because it hasn't a clean interface: the first
// array is passed by reference, the second by pointer - instead we have 2
// public versions of wxExecute() below
static long wxDoExecuteWithCapture(const wxString& command,
wxArrayString& output,
wxArrayString* error)
{
#ifdef __WIN16__
wxFAIL_MSG("Sorry, this version of wxExecute not implemented on WIN16.");
return 0;
#else
#else // !Win16
// create a wxProcess which will capture the output
wxProcess *process = new wxProcess;
process->Redirect();
@@ -1223,19 +1229,68 @@ long wxExecute(const wxString& command, wxArrayString& output)
#if wxUSE_STREAMS
if ( rc != -1 )
{
wxInputStream& is = *process->GetInputStream();
wxTextInputStream tis(is);
while ( !is.Eof() && is.IsOk() )
{
wxString line = tis.ReadLine();
if ( is.LastError() )
break;
wxInputStream* is = process->GetInputStream();
wxCHECK_MSG( is, -1, _T("if wxExecute() succeded, stream can't be NULL") );
wxTextInputStream tis(*is);
output.Add(line);
wxTextInputStream *tes = NULL;
wxInputStream *es = NULL;
if ( error )
{
es = process->GetErrorStream();
wxCHECK_MSG( es, -1, _T("stderr can't be NULL") );
tes = new wxTextInputStream(*es);
}
bool cont;
do
{
cont = FALSE;
if ( !is->Eof() && is->IsOk() )
{
wxString line = tis.ReadLine();
if ( is->LastError() )
break;
cont = TRUE;
output.Add(line);
}
if ( error && !es->Eof() && es->IsOk() )
{
wxString line = tes->ReadLine();
if ( es->LastError() )
break;
cont = TRUE;
error->Add(line);
}
}
while ( cont );
delete tes;
}
#endif
#endif // wxUSE_STREAMS
delete process;
return rc;
#endif
#endif // IO redirection supoprted
}
long wxExecute(const wxString& command, wxArrayString& output)
{
return wxDoExecuteWithCapture(command, output, NULL);
}
long wxExecute(const wxString& command,
wxArrayString& output,
wxArrayString& error)
{
return wxDoExecuteWithCapture(command, output, &error);
}