X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e2478fde622a16d25c66690af353dfdc37e7b582..7f5d8b0085b0140f62fb49dd8a0e50ed895e4632:/src/unix/utilsunx.cpp diff --git a/src/unix/utilsunx.cpp b/src/unix/utilsunx.cpp index f6d60dcf32..bfb252f998 100644 --- a/src/unix/utilsunx.cpp +++ b/src/unix/utilsunx.cpp @@ -15,12 +15,16 @@ // headers // ---------------------------------------------------------------------------- +// for compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" + #include "wx/defs.h" #include "wx/string.h" #include "wx/intl.h" #include "wx/log.h" #include "wx/app.h" +#include "wx/apptrait.h" #include "wx/utils.h" #include "wx/process.h" @@ -30,7 +34,15 @@ #include "wx/unix/execute.h" -#ifdef __WXBASE__ +#if wxUSE_STREAMS + +// define this to let wxexec.cpp know that we know what we're doing +#define _WX_USED_BY_WXEXECUTE_ +#include "../common/execcmn.cpp" + +#endif // wxUSE_STREAMS + +#if wxUSE_BASE #if defined( __MWERKS__ ) && defined(__MACH__) #define WXWIN_OS_DESCRIPTION "MacOS X" @@ -346,22 +358,6 @@ bool wxShutdown(wxShutdownFlags wFlags) #if wxUSE_STREAMS -// ---------------------------------------------------------------------------- -// wxPipeInputStream: stream for reading from a pipe -// ---------------------------------------------------------------------------- - -class wxPipeInputStream : public wxFileInputStream -{ -public: - wxPipeInputStream(int fd) : wxFileInputStream(fd) { } - - // return TRUE if the pipe is still opened - bool IsOpened() const { return !Eof(); } - - // return TRUE if we have anything to read, don't block - virtual bool CanRead() const; -}; - bool wxPipeInputStream::CanRead() const { if ( m_lasterror == wxSTREAM_EOF ) @@ -398,10 +394,6 @@ bool wxPipeInputStream::CanRead() const } } -// define this to let wxexec.cpp know that we know what we're doing -#define _WX_USED_BY_WXEXECUTE_ -#include "../common/execcmn.cpp" - #endif // wxUSE_STREAMS // ---------------------------------------------------------------------------- @@ -585,6 +577,9 @@ long wxExecute(wxChar **argv, { ARGS_CLEANUP; + // save it for WaitForChild() use + execData.pid = pid; + // prepare for IO redirection #if wxUSE_STREAMS @@ -828,17 +823,6 @@ wxString wxGetOsDescription() #endif // !__WXMAC__ -int wxGetOsVersion(int *verMaj, int *verMin) -{ - // we want this function to work even if there is no wxApp - wxConsoleAppTraits traitsConsole; - wxAppTraits *traits = wxTheApp ? wxTheApp->GetTraits() : NULL; - if ( ! traits ) - traits = &traitsConsole; - - return traits->GetOSVersion(verMaj, verMin); -} - unsigned long wxGetProcessId() { return (unsigned long)getpid(); @@ -1060,7 +1044,7 @@ void wxFatalError( const wxString &msg, const wxString &title ) #endif // WXWIN_COMPATIBILITY_2_2 -#endif // __WXBASE__ +#endif // wxUSE_BASE #if wxUSE_GUI @@ -1079,7 +1063,7 @@ bool wxGUIAppTraits::CreateEndProcessPipe(wxExecuteData& execData) bool wxGUIAppTraits::IsWriteFDOfEndProcessPipe(wxExecuteData& execData, int fd) { - return fd == execData.pipeEndProcDetect[wxPipe::Write] + return fd == (execData.pipeEndProcDetect)[wxPipe::Write]; } void wxGUIAppTraits::DetachWriteFDOfEndProcessPipe(wxExecuteData& execData)