// headers
// ----------------------------------------------------------------------------
+// for compilers that support precompilation, includes "wx.h".
+#include "wx/wxprec.h"
+
#include "wx/defs.h"
#include "wx/string.h"
#if defined( __MWERKS__ ) && defined(__MACH__)
#define WXWIN_OS_DESCRIPTION "MacOS X"
#define HAVE_NANOSLEEP
+#define HAVE_UNAME
#endif
// not only the statfs syscall is called differently depending on platform, but
// start an xterm executing it.
if ( !(flags & wxEXEC_SYNC) )
{
- for ( int fd = 0; fd < FD_SETSIZE; fd++ )
+ // FD_SETSIZE is unsigned under BSD, signed under other platforms
+ // so we need a cast to avoid warnings on all platforms
+ for ( int fd = 0; fd < (int)FD_SETSIZE; fd++ )
{
if ( fd == pipeIn[wxPipe::Read]
|| fd == pipeOut[wxPipe::Write]
{
ARGS_CLEANUP;
+ // save it for WaitForChild() use
+ execData.pid = pid;
+
// prepare for IO redirection
#if wxUSE_STREAMS
#endif // !__WXMAC__
-int wxGetOsVersion(int *verMaj, int *verMin)
-{
- // we want this function to work even if there is no wxApp
- wxConsoleAppTraits traitsConsole;
- wxAppTraits *traits = wxTheApp ? wxTheApp->GetTraits() : NULL;
- if ( ! traits )
- traits = &traitsConsole;
-
- return traits->GetOSVersion(verMaj, verMin);
-}
-
unsigned long wxGetProcessId()
{
return (unsigned long)getpid();
// process terminates
while ( endProcData->pid != 0 )
{
+ bool idle = true;
+
#if wxUSE_STREAMS
if ( execData.bufOut )
+ {
execData.bufOut->Update();
+ idle = false;
+ }
if ( execData.bufErr )
+ {
execData.bufErr->Update();
+ idle = false;
+ }
#endif // wxUSE_STREAMS
+ // don't consume 100% of the CPU while we're sitting this in this
+ // loop
+ if ( idle )
+ wxUsleep(1);
+
// give GTK+ a chance to call GTK_EndProcessDetector here and
// also repaint the GUI
wxYield();
}
}
+#endif // wxUSE_GUI
+#if wxUSE_BASE
+
void wxHandleProcessTermination(wxEndProcessData *proc_data)
{
// notify user about termination if required
}
}
-#endif // wxUSE_GUI
-
+#endif // wxUSE_BASE