]> git.saurik.com Git - wxWidgets.git/blob - src/unix/baseunix.cpp
OS X compilation fix
[wxWidgets.git] / 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
5 // Modified by:
6 // Created: 23.06.2003
7 // RCS-ID: $Id$
8 // Copyright: (c) 2003 Vadim Zeitlin <vadim@wxwindows.org>
9 // License: wxWindows licence
10 ///////////////////////////////////////////////////////////////////////////////
11
12 // ============================================================================
13 // declarations
14 // ============================================================================
15
16 // ----------------------------------------------------------------------------
17 // headers
18 // ----------------------------------------------------------------------------
19
20 // for compilers that support precompilation, includes "wx.h".
21 #include "wx/wxprec.h"
22
23 #ifdef __BORLANDC__
24 #pragma hdrstop
25 #endif
26
27 #ifndef WX_PRECOMP
28 #include "wx/log.h"
29 #include "wx/intl.h"
30 #include "wx/utils.h"
31 #endif //WX_PRECOMP
32
33 #include "wx/apptrait.h"
34 #include "wx/unix/execute.h"
35 #include "wx/evtloop.h"
36 #include "wx/unix/private/timer.h"
37
38 // for waitpid()
39 #include <sys/types.h>
40 #include <sys/wait.h>
41
42 // ============================================================================
43 // wxConsoleAppTraits implementation
44 // ============================================================================
45
46 // ----------------------------------------------------------------------------
47 // wxExecute support
48 // ----------------------------------------------------------------------------
49
50 bool wxConsoleAppTraits::CreateEndProcessPipe(wxExecuteData& WXUNUSED(data))
51 {
52 // nothing to do, so always ok
53 return true;
54 }
55
56 bool
57 wxConsoleAppTraits::IsWriteFDOfEndProcessPipe(wxExecuteData& WXUNUSED(data),
58 int WXUNUSED(fd))
59 {
60 // we don't have any pipe
61 return false;
62 }
63
64 void
65 wxConsoleAppTraits::DetachWriteFDOfEndProcessPipe(wxExecuteData& WXUNUSED(data))
66 {
67 // nothing to do
68 }
69
70
71 int
72 wxConsoleAppTraits::WaitForChild(wxExecuteData& execData)
73 {
74 wxASSERT_MSG( execData.flags & wxEXEC_SYNC,
75 wxT("async execution not supported yet") );
76
77 int exitcode = 0;
78 if ( waitpid(execData.pid, &exitcode, 0) == -1 || !WIFEXITED(exitcode) )
79 {
80 wxLogSysError(_("Waiting for subprocess termination failed"));
81 }
82
83 return exitcode;
84 }
85
86 wxTimerImpl *wxConsoleAppTraits::CreateTimerImpl(wxTimer *timer)
87 {
88 // this doesn't work yet as there is no main loop in console applications
89 // (but it will be added later)
90 return new wxUnixTimerImpl(timer);
91 }
92
93 wxEventLoopBase *wxConsoleAppTraits::CreateEventLoop()
94 {
95 return new wxEventLoop();
96 }
97