1 ///////////////////////////////////////////////////////////////////////////////
2 // Name: src/unix/apptraits.cpp
3 // Purpose: implementation of wxGUIAppTraits for Unix systems
4 // Author: Vadim Zeitlin
7 // Copyright: (c) 2008 Vadim Zeitlin <vadim@wxwindows.org>
8 // Licence: wxWindows licence
9 ///////////////////////////////////////////////////////////////////////////////
11 // ============================================================================
13 // ============================================================================
15 // ----------------------------------------------------------------------------
17 // ----------------------------------------------------------------------------
19 // for compilers that support precompilation, includes "wx.h".
20 #include "wx/wxprec.h"
29 #include "wx/apptrait.h"
30 #include "wx/unix/execute.h"
32 // ============================================================================
34 // ============================================================================
36 int wxGUIAppTraits::WaitForChild(wxExecuteData
& execData
)
38 const int flags
= execData
.flags
;
39 if ( !(flags
& wxEXEC_SYNC
) || (flags
& wxEXEC_NOEVENTS
) )
41 // async or blocking sync cases are already handled by the base class
42 // just fine, no need to duplicate its code here
43 return wxAppTraits::WaitForChild(execData
);
46 // here we're dealing with the case of synchronous execution when we want
47 // to process the GUI events while waiting for the child termination
49 wxEndProcessData endProcData
;
50 endProcData
.pid
= execData
.pid
;
51 endProcData
.tag
= AddProcessCallback
54 execData
.GetEndProcReadFD()
56 endProcData
.async
= false;
59 // prepare to wait for the child termination: show to the user that we're
60 // busy and refuse all input unless explicitly told otherwise
62 wxWindowDisabler
wd(!(flags
& wxEXEC_NODISABLE
));
64 // endProcData.pid will be set to 0 from wxHandleProcessTermination() when
65 // the process terminates
66 while ( endProcData
.pid
!= 0 )
68 // don't consume 100% of the CPU while we're sitting in this
70 if ( !CheckForRedirectedIO(execData
) )
73 // give the toolkit a chance to call wxHandleProcessTermination() here
74 // and also repaint the GUI and handle other accumulated events
78 return endProcData
.exitcode
;