]> git.saurik.com Git - wxWidgets.git/blobdiff - src/common/process.cpp
As small as possible reorganization within wxDateTime to please PCH in DLL build...
[wxWidgets.git] / src / common / process.cpp
index d98c7178ef5ddd45ebf73151f6964e7e39fad240..518549e660f8571cb89841f3f3e22227fb64fb47 100644 (file)
@@ -6,7 +6,7 @@
 // Created:     24/06/98
 // RCS-ID:      $Id$
 // Copyright:   (c) Guilhem Lavaux
-// Licence:     wxWindows license
+// Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
 // ============================================================================
@@ -17,7 +17,7 @@
 // headers
 // ----------------------------------------------------------------------------
 
-#ifdef __GNUG__
+#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
     #pragma implementation "process.h"
 #endif
 
@@ -47,6 +47,15 @@ IMPLEMENT_DYNAMIC_CLASS(wxProcessEvent, wxEvent)
 // wxProcess creation
 // ----------------------------------------------------------------------------
 
+#if WXWIN_COMPATIBILITY_2_2
+
+wxProcess::wxProcess(wxEvtHandler *parent, bool redirect)
+{
+    Init(parent, wxID_ANY, redirect ? wxPROCESS_REDIRECT : wxPROCESS_DEFAULT);
+}
+
+#endif // WXWIN_COMPATIBILITY_2_2
+
 void wxProcess::Init(wxEvtHandler *parent, int id, int flags)
 {
     if ( parent )
@@ -63,10 +72,11 @@ void wxProcess::Init(wxEvtHandler *parent, int id, int flags)
 }
 
 /* static */
-wxProcess *wxProcess::Open(const wxString& cmd)
+wxProcess *wxProcess::Open(const wxString& cmd, int flags)
 {
+    wxASSERT_MSG( !(flags & wxEXEC_SYNC), wxT("wxEXEC_SYNC should not be used." ));
     wxProcess *process = new wxProcess(wxPROCESS_REDIRECT);
-    if ( !wxExecute(cmd, wxEXEC_ASYNC, process) )
+    if ( !wxExecute(cmd, flags, process) )
     {
         // couldn't launch the process
         delete process;
@@ -119,6 +129,21 @@ void wxProcess::SetPipeStreams(wxInputStream *inputSstream,
     m_outputStream = outputStream;
 }
 
+bool wxProcess::IsInputOpened() const
+{
+    return m_inputStream && m_inputStream->GetLastError() != wxSTREAM_EOF;
+}
+
+bool wxProcess::IsInputAvailable() const
+{
+    return m_inputStream && m_inputStream->CanRead();
+}
+
+bool wxProcess::IsErrorAvailable() const
+{
+    return m_errorStream && m_errorStream->CanRead();
+}
+
 #endif // wxUSE_STREAMS
 
 // ----------------------------------------------------------------------------
@@ -126,10 +151,10 @@ void wxProcess::SetPipeStreams(wxInputStream *inputSstream,
 // ----------------------------------------------------------------------------
 
 /* static */
-wxKillError wxProcess::Kill(int pid, wxSignal sig)
+wxKillError wxProcess::Kill(int pid, wxSignal sig, int flags)
 {
     wxKillError rc;
-    (void)wxKill(pid, sig, &rc);
+    (void)wxKill(pid, sig, &rc, flags);
 
     return rc;
 }
@@ -141,7 +166,7 @@ bool wxProcess::Exists(int pid)
     {
         case wxKILL_OK:
         case wxKILL_ACCESS_DENIED:
-            return TRUE;
+            return true;
 
         default:
         case wxKILL_ERROR:
@@ -150,7 +175,7 @@ bool wxProcess::Exists(int pid)
             // fall through
 
         case wxKILL_NO_PROCESS:
-            return FALSE;
+            return false;
     }
 }