~ubuntu-branches/ubuntu/lucid/codelite/lucid

« back to all changes in this revision

Viewing changes to CodeLite/winprocess.h

  • Committer: Bazaar Package Importer
  • Author(s): Chow Loong Jin
  • Date: 2009-01-12 15:46:55 UTC
  • Revision ID: james.westby@ubuntu.com-20090112154655-sdynrljcb6u167yw
Tags: upstream-1.0.2674+dfsg
ImportĀ upstreamĀ versionĀ 1.0.2674+dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//////////////////////////////////////////////////////////////////////////////
 
2
//////////////////////////////////////////////////////////////////////////////
 
3
//
 
4
// copyright            : (C) 2008 by Eran Ifrah                            
 
5
// file name            : winprocess.h              
 
6
//                                                                          
 
7
// -------------------------------------------------------------------------
 
8
// A                                                                        
 
9
//              _____           _      _     _ _                            
 
10
//             /  __ \         | |    | |   (_) |                           
 
11
//             | /  \/ ___   __| | ___| |    _| |_ ___                      
 
12
//             | |    / _ \ / _  |/ _ \ |   | | __/ _ )                     
 
13
//             | \__/\ (_) | (_| |  __/ |___| | ||  __/                     
 
14
//              \____/\___/ \__,_|\___\_____/_|\__\___|                     
 
15
//                                                                          
 
16
//                                                  F i l e                 
 
17
//                                                                          
 
18
//    This program is free software; you can redistribute it and/or modify  
 
19
//    it under the terms of the GNU General Public License as published by  
 
20
//    the Free Software Foundation; either version 2 of the License, or     
 
21
//    (at your option) any later version.                                   
 
22
//                                                                          
 
23
//////////////////////////////////////////////////////////////////////////////
 
24
//////////////////////////////////////////////////////////////////////////////
 
25
 #ifndef __winprocess__
 
26
#define __winprocess__
 
27
 
 
28
#ifdef __WXMSW__
 
29
 
 
30
#include <wx/string.h>
 
31
#include <Windows.h>
 
32
 
 
33
class WinProcess
 
34
{
 
35
public:
 
36
        WinProcess();
 
37
        virtual ~WinProcess();
 
38
 
 
39
        // Create process asynchronously and return a process object
 
40
        static WinProcess* Execute(const wxString& cmd, wxString &errMsg, const wxString &workingDir = wxEmptyString);
 
41
 
 
42
        // Read from process stdout - return immediately if no data is available
 
43
        bool Read(wxString& buff);
 
44
 
 
45
        // Write to the process stdin
 
46
        bool Write(const wxString& buff);
 
47
 
 
48
        // Return true if the process is still alive
 
49
        bool IsAlive();
 
50
 
 
51
        // Clean the process resources and kill the process if it is
 
52
        // still alive
 
53
        void Cleanup();
 
54
        
 
55
private:
 
56
        // WINDOWS implementation
 
57
        // Creating process related handles
 
58
        HANDLE  hChildStdinRd, hChildStdinWr, hChildStdinWrDup, 
 
59
                        hChildStdoutRd, hChildStdoutWr, hChildStdoutRdDup, 
 
60
                        hSaveStdin, hSaveStdout;
 
61
 
 
62
        // Child process id & information 
 
63
        DWORD dwProcessId;
 
64
        PROCESS_INFORMATION piProcInfo;
 
65
};
 
66
 
 
67
#endif
 
68
 
 
69
#endif // __winprocess__