1999-03-05 19:11:27 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: unix/execute.h
|
|
|
|
// Purpose: private details of wxExecute() implementation
|
|
|
|
// Author: Vadim Zeitlin
|
|
|
|
// Id: $Id$
|
|
|
|
// Copyright: (c) 1998 Robert Roebling, Julian Smart, Vadim Zeitlin
|
2004-05-23 16:53:33 -04:00
|
|
|
// Licence: wxWindows licence
|
1999-03-05 19:11:27 -05:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
#ifndef _WX_UNIX_EXECUTE_H
|
|
|
|
#define _WX_UNIX_EXECUTE_H
|
|
|
|
|
2003-06-23 20:56:19 -04:00
|
|
|
#include "wx/unix/pipe.h"
|
|
|
|
|
2005-08-02 18:58:06 -04:00
|
|
|
class WXDLLIMPEXP_BASE wxProcess;
|
2003-06-23 20:56:19 -04:00
|
|
|
class wxStreamTempInputBuffer;
|
|
|
|
|
1999-03-05 19:11:27 -05:00
|
|
|
// if pid > 0, the execution is async and the data is freed in the callback
|
|
|
|
// executed when the process terminates, if pid < 0, the execution is
|
|
|
|
// synchronous and the caller (wxExecute) frees the data
|
|
|
|
struct wxEndProcessData
|
|
|
|
{
|
|
|
|
int pid, // pid of the process
|
|
|
|
tag; // port dependent value
|
|
|
|
wxProcess *process; // if !NULL: notified on process termination
|
|
|
|
int exitcode; // the exit code
|
|
|
|
};
|
|
|
|
|
2003-06-23 20:56:19 -04:00
|
|
|
// struct in which information is passed from wxExecute() to wxAppTraits
|
|
|
|
// methods
|
|
|
|
struct wxExecuteData
|
|
|
|
{
|
|
|
|
wxExecuteData()
|
|
|
|
{
|
|
|
|
flags =
|
|
|
|
pid = 0;
|
|
|
|
|
|
|
|
process = NULL;
|
|
|
|
|
|
|
|
#if wxUSE_STREAMS
|
|
|
|
bufOut =
|
|
|
|
bufErr = NULL;
|
|
|
|
#endif // wxUSE_STREAMS
|
|
|
|
}
|
|
|
|
|
|
|
|
// wxExecute() flags
|
|
|
|
int flags;
|
|
|
|
|
|
|
|
// the pid of the child process
|
|
|
|
int pid;
|
|
|
|
|
|
|
|
// the associated process object or NULL
|
|
|
|
wxProcess *process;
|
|
|
|
|
|
|
|
// pipe used for end process detection
|
|
|
|
wxPipe pipeEndProcDetect;
|
|
|
|
|
|
|
|
#if wxUSE_STREAMS
|
|
|
|
// the input buffer bufOut is connected to stdout, this is why it is
|
|
|
|
// called bufOut and not bufIn
|
|
|
|
wxStreamTempInputBuffer *bufOut,
|
|
|
|
*bufErr;
|
|
|
|
#endif // wxUSE_STREAMS
|
|
|
|
};
|
|
|
|
|
1999-03-05 19:11:27 -05:00
|
|
|
// this function is called when the process terminates from port specific
|
|
|
|
// callback function and is common to all ports (src/unix/utilsunx.cpp)
|
2005-08-02 18:58:06 -04:00
|
|
|
extern WXDLLIMPEXP_BASE void wxHandleProcessTermination(wxEndProcessData *proc_data);
|
1999-03-05 19:11:27 -05:00
|
|
|
|
|
|
|
// this function is called to associate the port-specific callback with the
|
|
|
|
// child process. The return valus is port-specific.
|
2005-08-02 18:58:06 -04:00
|
|
|
extern WXDLLIMPEXP_CORE int wxAddProcessCallback(wxEndProcessData *proc_data, int fd);
|
2003-06-23 20:56:19 -04:00
|
|
|
|
2004-10-24 03:36:16 -04:00
|
|
|
#if defined(__DARWIN__) && (defined(__WXMAC__) || defined(__WXCOCOA__))
|
2003-03-26 12:46:14 -05:00
|
|
|
// For ports (e.g. DARWIN) which can add callbacks based on the pid
|
|
|
|
extern int wxAddProcessCallbackForPid(wxEndProcessData *proc_data, int pid);
|
2004-01-02 15:45:35 -05:00
|
|
|
#endif
|
1999-03-05 19:11:27 -05:00
|
|
|
|
|
|
|
#endif // _WX_UNIX_EXECUTE_H
|