]>
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"
35 #include "wx/evtloop.h"
36 #include "wx/gsocket.h"
38 #include "wx/unix/private/timer.h"
41 #include <sys/types.h>
44 // ============================================================================
45 // wxConsoleAppTraits implementation
46 // ============================================================================
49 wxConsoleAppTraits::WaitForChild(wxExecuteData
& execData
)
52 if ( execData
.flags
& wxEXEC_SYNC
)
54 if ( waitpid(execData
.pid
, &exitcode
, 0) == -1 || !WIFEXITED(exitcode
) )
56 wxLogSysError(_("Waiting for subprocess termination failed"));
59 else // asynchronous execution
61 wxEndProcessData
*endProcData
= new wxEndProcessData
;
62 endProcData
->process
= execData
.process
;
63 endProcData
->pid
= execData
.pid
;
64 endProcData
->tag
= wxAddProcessCallback
67 execData
.pipeEndProcDetect
.Detach(wxPipe::Read
)
70 execData
.pipeEndProcDetect
.Close();
71 exitcode
= execData
.pid
;
80 wxTimerImpl
*wxConsoleAppTraits::CreateTimerImpl(wxTimer
*timer
)
82 // this doesn't work yet as there is no main loop in console applications
83 // (but it will be added later)
84 return new wxUnixTimerImpl(timer
);
89 // Note: wxConsoleAppTraits::CreateEventLoop() is defined in evtloopunix.cpp!