]>
Commit | Line | Data |
---|---|---|
e2478fde | 1 | /////////////////////////////////////////////////////////////////////////////// |
de6185e2 | 2 | // Name: src/unix/baseunix.cpp |
e2478fde VZ |
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> | |
65571936 | 9 | // License: wxWindows licence |
e2478fde VZ |
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 | |
8df6de97 VS |
28 | #include "wx/log.h" |
29 | #include "wx/intl.h" | |
de6185e2 | 30 | #include "wx/utils.h" |
e2478fde VZ |
31 | #endif //WX_PRECOMP |
32 | ||
33 | #include "wx/apptrait.h" | |
8df6de97 | 34 | #include "wx/unix/execute.h" |
b46b1d59 | 35 | #include "wx/evtloop.h" |
8e913f79 | 36 | |
3c029873 | 37 | #include "wx/unix/private/timer.h" |
e2478fde VZ |
38 | |
39 | // for waitpid() | |
40 | #include <sys/types.h> | |
41 | #include <sys/wait.h> | |
42 | ||
43 | // ============================================================================ | |
44 | // wxConsoleAppTraits implementation | |
45 | // ============================================================================ | |
46 | ||
47 | // ---------------------------------------------------------------------------- | |
48 | // wxExecute support | |
49 | // ---------------------------------------------------------------------------- | |
50 | ||
51 | bool wxConsoleAppTraits::CreateEndProcessPipe(wxExecuteData& WXUNUSED(data)) | |
52 | { | |
53 | // nothing to do, so always ok | |
54 | return true; | |
55 | } | |
56 | ||
57 | bool | |
58 | wxConsoleAppTraits::IsWriteFDOfEndProcessPipe(wxExecuteData& WXUNUSED(data), | |
59 | int WXUNUSED(fd)) | |
60 | { | |
61 | // we don't have any pipe | |
62 | return false; | |
63 | } | |
64 | ||
65 | void | |
66 | wxConsoleAppTraits::DetachWriteFDOfEndProcessPipe(wxExecuteData& WXUNUSED(data)) | |
67 | { | |
68 | // nothing to do | |
69 | } | |
70 | ||
71 | ||
72 | int | |
73 | wxConsoleAppTraits::WaitForChild(wxExecuteData& execData) | |
74 | { | |
75 | wxASSERT_MSG( execData.flags & wxEXEC_SYNC, | |
76 | wxT("async execution not supported yet") ); | |
77 | ||
78 | int exitcode = 0; | |
79 | if ( waitpid(execData.pid, &exitcode, 0) == -1 || !WIFEXITED(exitcode) ) | |
80 | { | |
81 | wxLogSysError(_("Waiting for subprocess termination failed")); | |
82 | } | |
83 | ||
84 | return exitcode; | |
85 | } | |
86 | ||
8e913f79 VZ |
87 | #if wxUSE_TIMER |
88 | ||
b46b1d59 | 89 | wxTimerImpl *wxConsoleAppTraits::CreateTimerImpl(wxTimer *timer) |
c2ca375c VZ |
90 | { |
91 | // this doesn't work yet as there is no main loop in console applications | |
92 | // (but it will be added later) | |
93 | return new wxUnixTimerImpl(timer); | |
94 | } | |
b46b1d59 | 95 | |
8e913f79 VZ |
96 | #endif // wxUSE_TIMER |
97 | ||
37ab9399 | 98 | // Note: wxConsoleAppTraits::CreateEventLoop() is defined in evtloopunix.cpp! |