Sync with FPS head, including the following patches:
[packages/old-time.git] / include / runProcess.h
1 /* ----------------------------------------------------------------------------
2 (c) The University of Glasgow 2004
3
4 Interface for code in runProcess.c (providing support for System.Process)
5 ------------------------------------------------------------------------- */
6
7 #if !defined(mingw32_HOST_OS) && !defined(__MINGW32__)
8 typedef pid_t ProcHandle;
9 #else
10 // Should really be intptr_t, but we don't have that type on the Haskell side
11 typedef long ProcHandle;
12 #endif
13
14 #if !defined(mingw32_HOST_OS) && !defined(__MINGW32__)
15
16 extern ProcHandle runProcess( char *const args[],
17 char *workingDirectory, char **environment,
18 int fdStdInput, int fdStdOutput, int fdStdError,
19 int set_inthandler, long inthandler,
20 int set_quithandler, long quithandler);
21
22 extern ProcHandle runInteractiveProcess( char *const args[],
23 char *workingDirectory,
24 char **environment,
25 int *pfdStdInput,
26 int *pfdStdOutput,
27 int *pfdStdError);
28
29 #else
30
31 extern ProcHandle runProcess( char *cmd,
32 char *workingDirectory, void *environment,
33 int fdStdInput, int fdStdOutput, int fdStdError);
34
35 extern ProcHandle runInteractiveProcess( char *cmd,
36 char *workingDirectory,
37 void *environment,
38 int *pfdStdInput,
39 int *pfdStdOutput,
40 int *pfdStdError);
41
42 #endif
43
44 extern int terminateProcess( ProcHandle handle );
45 extern int getProcessExitCode( ProcHandle handle, int *pExitCode );
46 extern int waitForProcess( ProcHandle handle );