From: Vadim Zeitlin Date: Sat, 22 Mar 2008 14:15:28 +0000 (+0000) Subject: get rid of traits functions unnecessary now that wxExecute() works in both base and... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/3bbd09c34c773caa1210ffd441059c05b94cbbbc?ds=inline 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 --- diff --git a/include/wx/unix/apptbase.h b/include/wx/unix/apptbase.h index c101570201..0f77452390 100644 --- a/include/wx/unix/apptbase.h +++ b/include/wx/unix/apptbase.h @@ -26,20 +26,6 @@ public: // 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 // return // diff --git a/src/unix/utilsunx.cpp b/src/unix/utilsunx.cpp index 131aac407c..305c194cf7 100644 --- a/src/unix/utilsunx.cpp +++ b/src/unix/utilsunx.cpp @@ -516,7 +516,7 @@ long wxExecute(wxChar **argv, int flags, wxProcess *process) execData.process = process; // create pipes - if ( !traits->CreateEndProcessPipe(execData) ) + if ( !execData.pipeEndProcDetect.Create() ) { wxLogError( _("Failed to execute '%s'\n"), *argv ); @@ -576,7 +576,7 @@ long wxExecute(wxChar **argv, int flags, wxProcess *process) if ( fd == pipeIn[wxPipe::Read] || fd == pipeOut[wxPipe::Write] || fd == pipeErr[wxPipe::Write] - || traits->IsWriteFDOfEndProcessPipe(execData, fd) ) + || fd == (execData.pipeEndProcDetect)[wxPipe::Write] ) { // don't close this one, we still need it continue; @@ -598,8 +598,10 @@ long wxExecute(wxChar **argv, int flags, wxProcess *process) #endif // !__VMS // reading side can be safely closed but we should keep the write one - // opened - traits->DetachWriteFDOfEndProcessPipe(execData); + // opened, it will be only closed when the process terminates resulting + // in a read notification to the parent + execData.pipeEndProcDetect.Detach(wxPipe::Write); + execData.pipeEndProcDetect.Close(); // redirect stdin, stdout and stderr if ( pipeIn.IsOk() ) @@ -1225,22 +1227,6 @@ bool wxHandleFatalExceptions(bool doit) // 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) { // define a custom handler processing only the closure of the descriptor