]>
git.saurik.com Git - wxWidgets.git/blob - src/unix/baseunix.cpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/unix/baseunix.cpp
3 // Purpose: misc stuff only used in console applications under Unix
4 // Author: Vadim Zeitlin
8 // Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwindows.org>
9 // License: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
12 // ============================================================================
14 // ============================================================================
16 // ----------------------------------------------------------------------------
18 // ----------------------------------------------------------------------------
20 // for compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
33 #include "wx/apptrait.h"
34 #include "wx/unix/execute.h"
37 #include <sys/types.h>
40 // ============================================================================
41 // wxConsoleAppTraits implementation
42 // ============================================================================
44 // ----------------------------------------------------------------------------
46 // ----------------------------------------------------------------------------
48 bool wxConsoleAppTraits::CreateEndProcessPipe(wxExecuteData
& WXUNUSED(data
))
50 // nothing to do, so always ok
55 wxConsoleAppTraits::IsWriteFDOfEndProcessPipe(wxExecuteData
& WXUNUSED(data
),
58 // we don't have any pipe
63 wxConsoleAppTraits::DetachWriteFDOfEndProcessPipe(wxExecuteData
& WXUNUSED(data
))
70 wxConsoleAppTraits::WaitForChild(wxExecuteData
& execData
)
72 wxASSERT_MSG( execData
.flags
& wxEXEC_SYNC
,
73 wxT("async execution not supported yet") );
76 if ( waitpid(execData
.pid
, &exitcode
, 0) == -1 || !WIFEXITED(exitcode
) )
78 wxLogSysError(_("Waiting for subprocess termination failed"));
84 // ----------------------------------------------------------------------------
86 // ----------------------------------------------------------------------------
88 // this is in mac/utils.cpp under Mac
89 #if !defined(__WXMAC__)
91 wxToolkitInfo
& wxConsoleAppTraits::GetToolkitInfo()
93 static wxToolkitInfo info
;
96 FILE *f
= popen("uname -r", "r");
100 size_t c
= fread(buf
, 1, sizeof(buf
) - 1, f
);
103 if ( sscanf(buf
, "%d.%d", &major
, &minor
) != 2 )
105 // unrecognized uname string format
112 // failed to run uname
117 info
.versionMajor
= major
;
118 info
.versionMinor
= minor
;
119 info
.name
= _T("wxBase");