]> git.saurik.com Git - wxWidgets.git/blob - include/wx/unix/execute.h
Fix compilation errors under OSX.
[wxWidgets.git] / include / wx / unix / execute.h
1 /////////////////////////////////////////////////////////////////////////////
2 // Name: wx/unix/execute.h
3 // Purpose: private details of wxExecute() implementation
4 // Author: Vadim Zeitlin
5 // Id: $Id$
6 // Copyright: (c) 1998 Robert Roebling, Julian Smart, Vadim Zeitlin
7 // Licence: wxWindows licence
8 /////////////////////////////////////////////////////////////////////////////
9
10 #ifndef _WX_UNIX_EXECUTE_H
11 #define _WX_UNIX_EXECUTE_H
12
13 #include "wx/unix/pipe.h"
14
15 class WXDLLIMPEXP_FWD_BASE wxProcess;
16 class wxStreamTempInputBuffer;
17
18 struct wxEndProcessData
19 {
20 wxEndProcessData()
21 {
22 pid =
23 tag =
24 exitcode = -1;
25 process = NULL;
26 async = false;
27 }
28
29 int pid; // pid of the process
30 int tag; // port dependent value
31 wxProcess *process; // if !NULL: notified on process termination
32 int exitcode; // the exit code
33 bool async; // if true, delete us on process termination
34 };
35
36 // struct in which information is passed from wxExecute() to wxAppTraits
37 // methods
38 struct wxExecuteData
39 {
40 wxExecuteData()
41 {
42 flags =
43 pid = 0;
44
45 process = NULL;
46
47 #if wxUSE_STREAMS
48 bufOut =
49 bufErr = NULL;
50
51 fdOut =
52 fdErr = wxPipe::INVALID_FD;
53 #endif // wxUSE_STREAMS
54 }
55
56 // get the FD corresponding to the read end of the process end detection
57 // pipe and close the write one
58 int GetEndProcReadFD()
59 {
60 const int fd = pipeEndProcDetect.Detach(wxPipe::Read);
61 pipeEndProcDetect.Close();
62 return fd;
63 }
64
65
66 // wxExecute() flags
67 int flags;
68
69 // the pid of the child process
70 int pid;
71
72 // the associated process object or NULL
73 wxProcess *process;
74
75 // pipe used for end process detection
76 wxPipe pipeEndProcDetect;
77
78 #if wxUSE_STREAMS
79 // the input buffer bufOut is connected to stdout, this is why it is
80 // called bufOut and not bufIn
81 wxStreamTempInputBuffer *bufOut,
82 *bufErr;
83
84 // the corresponding FDs, -1 if not redirected
85 int fdOut,
86 fdErr;
87 #endif // wxUSE_STREAMS
88 };
89
90 // this function is called when the process terminates from port specific
91 // callback function and is common to all ports (src/unix/utilsunx.cpp)
92 extern WXDLLIMPEXP_BASE void wxHandleProcessTermination(wxEndProcessData *proc_data);
93
94 #endif // _WX_UNIX_EXECUTE_H