]>
Commit | Line | Data |
---|---|---|
518b5d2f VZ |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: 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 | |
65571936 | 7 | // Licence: wxWindows licence |
518b5d2f VZ |
8 | ///////////////////////////////////////////////////////////////////////////// |
9 | ||
10 | #ifndef _WX_UNIX_EXECUTE_H | |
11 | #define _WX_UNIX_EXECUTE_H | |
12 | ||
e2478fde VZ |
13 | #include "wx/unix/pipe.h" |
14 | ||
b5dbe15d | 15 | class WXDLLIMPEXP_FWD_BASE wxProcess; |
e2478fde VZ |
16 | class wxStreamTempInputBuffer; |
17 | ||
518b5d2f VZ |
18 | struct wxEndProcessData |
19 | { | |
e528a71b VZ |
20 | wxEndProcessData() |
21 | { | |
22 | pid = | |
23 | tag = | |
24 | exitcode = -1; | |
25 | process = NULL; | |
26 | async = false; | |
27 | } | |
28 | ||
46c7e1a1 VS |
29 | int pid; // pid of the process |
30 | int tag; // port dependent value | |
518b5d2f | 31 | wxProcess *process; // if !NULL: notified on process termination |
e528a71b VZ |
32 | int exitcode; // the exit code |
33 | bool async; // if true, delete us on process termination | |
518b5d2f VZ |
34 | }; |
35 | ||
e2478fde VZ |
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; | |
33343395 VZ |
50 | |
51 | fdOut = | |
52 | fdErr = wxPipe::INVALID_FD; | |
e2478fde VZ |
53 | #endif // wxUSE_STREAMS |
54 | } | |
55 | ||
33343395 VZ |
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 | ||
e2478fde VZ |
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; | |
33343395 VZ |
83 | |
84 | // the corresponding FDs, -1 if not redirected | |
85 | int fdOut, | |
86 | fdErr; | |
e2478fde VZ |
87 | #endif // wxUSE_STREAMS |
88 | }; | |
89 | ||
518b5d2f VZ |
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) | |
20123d49 | 92 | extern WXDLLIMPEXP_BASE void wxHandleProcessTermination(wxEndProcessData *proc_data); |
518b5d2f | 93 | |
518b5d2f | 94 | #endif // _WX_UNIX_EXECUTE_H |