File: runProcess.h

package info (click to toggle)
ghc 9.6.6-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, trixie
  • size: 158,216 kB
  • sloc: haskell: 648,228; ansic: 81,656; cpp: 11,808; javascript: 8,444; sh: 5,831; fortran: 3,527; python: 3,277; asm: 2,523; makefile: 2,298; yacc: 1,570; lisp: 532; xml: 196; perl: 145; csh: 2
file content (92 lines) | stat: -rw-r--r-- 3,621 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
/* ----------------------------------------------------------------------------
   (c) The University of Glasgow 2004

   Interface for code in runProcess.c (providing support for System.Process)
   ------------------------------------------------------------------------- */

#pragma once

#include "HsProcessConfig.h"
// Otherwise these clash with similar definitions from other packages:
#undef PACKAGE_BUGREPORT
#undef PACKAGE_NAME
#undef PACKAGE_STRING
#undef PACKAGE_TARNAME
#undef PACKAGE_VERSION

#if defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32)
#define UNICODE
#include <windows.h>
#include <stdlib.h>
#include <stdbool.h>
#endif

#if !(defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32))
#include <sys/types.h>
typedef pid_t ProcHandle;
#else
// Should really be intptr_t, but we don't have that type on the Haskell side
typedef PHANDLE ProcHandle;
#endif

#include "processFlags.h"

#include <ghcplatform.h>

#if defined(wasm32_HOST_ARCH)

#elif !(defined(_MSC_VER) || defined(__MINGW32__) || defined(_WIN32))

#include <pwd.h>
#include <grp.h>

extern ProcHandle runInteractiveProcess( char *const args[],
                                         char *workingDirectory,
                                         char **environment,
                                         int fdStdIn,
                                         int fdStdOut,
                                         int fdStdErr,
                                         int *pfdStdInput,
                                         int *pfdStdOutput,
                                         int *pfdStdError,
                                         gid_t *childGroup,
                                         uid_t *childUser,
                                         int flags,
                                         char **failed_doing);

#else

extern ProcHandle runInteractiveProcess( wchar_t *cmd,
                                         wchar_t *workingDirectory,
                                         wchar_t *environment,
                                         int fdStdIn,
                                         int fdStdOut,
                                         int fdStdErr,
                                         int *pfdStdInput,
                                         int *pfdStdOutput,
                                         int *pfdStdError,
                                         int flags,
                                         bool useJobObject,
                                         HANDLE *hJob );

extern ProcHandle runInteractiveProcessHANDLE ( wchar_t *cmd,
                                                wchar_t *workingDirectory,
                                                wchar_t *environment,
                                                HANDLE _stdin,
                                                HANDLE _stdout,
                                                HANDLE _stderr,
                                                HANDLE *pStdInput,
                                                HANDLE *pStdOutput,
                                                HANDLE *pStdError,
                                                int flags,
                                                bool useJobObject,
                                                HANDLE *hJob);

extern int terminateJob( ProcHandle handle );
extern int waitForJobCompletion( HANDLE hJob );

#endif

extern int terminateProcess( ProcHandle handle );
extern int getProcessExitCode( ProcHandle handle, int *pExitCode );
extern int waitForProcess( ProcHandle handle, int *ret );