get rid of traits functions unnecessary now that wxExecute() works in both base and GUI ports

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52693 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-03-22 14:15:28 +00:00
parent 33343395da
commit 3bbd09c34c
2 changed files with 6 additions and 34 deletions

View File

@@ -26,20 +26,6 @@ public:
// wxExecute() support methods // wxExecute() support methods
// --------------------------- // ---------------------------
// called before starting the child process and creates the pipe used for
// detecting the process termination asynchronously in GUI, does nothing in
// wxBase
//
// if it returns false, we should return from wxExecute() with an error
virtual bool CreateEndProcessPipe(wxExecuteData& execData);
// test if the given descriptor is the end of the pipe create by the
// function above
virtual bool IsWriteFDOfEndProcessPipe(wxExecuteData& execData, int fd);
// ensure that the write end of the pipe is not closed by wxPipe dtor
virtual void DetachWriteFDOfEndProcessPipe(wxExecuteData& execData);
// wait for the process termination, return whatever wxExecute() must // wait for the process termination, return whatever wxExecute() must
// return // return
// //

View File

@@ -516,7 +516,7 @@ long wxExecute(wxChar **argv, int flags, wxProcess *process)
execData.process = process; execData.process = process;
// create pipes // create pipes
if ( !traits->CreateEndProcessPipe(execData) ) if ( !execData.pipeEndProcDetect.Create() )
{ {
wxLogError( _("Failed to execute '%s'\n"), *argv ); wxLogError( _("Failed to execute '%s'\n"), *argv );
@@ -576,7 +576,7 @@ long wxExecute(wxChar **argv, int flags, wxProcess *process)
if ( fd == pipeIn[wxPipe::Read] if ( fd == pipeIn[wxPipe::Read]
|| fd == pipeOut[wxPipe::Write] || fd == pipeOut[wxPipe::Write]
|| fd == pipeErr[wxPipe::Write] || fd == pipeErr[wxPipe::Write]
|| traits->IsWriteFDOfEndProcessPipe(execData, fd) ) || fd == (execData.pipeEndProcDetect)[wxPipe::Write] )
{ {
// don't close this one, we still need it // don't close this one, we still need it
continue; continue;
@@ -598,8 +598,10 @@ long wxExecute(wxChar **argv, int flags, wxProcess *process)
#endif // !__VMS #endif // !__VMS
// reading side can be safely closed but we should keep the write one // reading side can be safely closed but we should keep the write one
// opened // opened, it will be only closed when the process terminates resulting
traits->DetachWriteFDOfEndProcessPipe(execData); // in a read notification to the parent
execData.pipeEndProcDetect.Detach(wxPipe::Write);
execData.pipeEndProcDetect.Close();
// redirect stdin, stdout and stderr // redirect stdin, stdout and stderr
if ( pipeIn.IsOk() ) if ( pipeIn.IsOk() )
@@ -1225,22 +1227,6 @@ bool wxHandleFatalExceptions(bool doit)
// wxExecute support // wxExecute support
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
bool wxAppTraits::CreateEndProcessPipe(wxExecuteData& execData)
{
return execData.pipeEndProcDetect.Create();
}
bool wxAppTraits::IsWriteFDOfEndProcessPipe(wxExecuteData& execData, int fd)
{
return fd == (execData.pipeEndProcDetect)[wxPipe::Write];
}
void wxAppTraits::DetachWriteFDOfEndProcessPipe(wxExecuteData& execData)
{
execData.pipeEndProcDetect.Detach(wxPipe::Write);
execData.pipeEndProcDetect.Close();
}
int wxAppTraits::AddProcessCallback(wxEndProcessData *data, int fd) int wxAppTraits::AddProcessCallback(wxEndProcessData *data, int fd)
{ {
// define a custom handler processing only the closure of the descriptor // define a custom handler processing only the closure of the descriptor