ObjFW
 All Classes Functions Variables
OFProcess.h
1 /*
2  * Copyright (c) 2008, 2009, 2010, 2011, 2012
3  * Jonathan Schleifer <js@webkeks.org>
4  *
5  * All rights reserved.
6  *
7  * This file is part of ObjFW. It may be distributed under the terms of the
8  * Q Public License 1.0, which can be found in the file LICENSE.QPL included in
9  * the packaging of this file.
10  *
11  * Alternatively, it may be distributed under the terms of the GNU General
12  * Public License, either version 2 or 3, which can be found in the file
13  * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this
14  * file.
15  */
16 
17 #ifndef __STDC_LIMIT_MACROS
18 # define __STDC_LIMIT_MACROS
19 #endif
20 #ifndef __STDC_CONSTANT_MACROS
21 # define __STDC_CONSTANT_MACROS
22 #endif
23 
24 #include <sys/types.h>
25 
26 #import "OFStream.h"
27 
28 #ifdef _WIN32
29 # include <windows.h>
30 #endif
31 
35 @interface OFProcess: OFStream
36 {
37 #ifndef _WIN32
38  pid_t pid;
39  int readPipe[2], writePipe[2];
40 #else
41  HANDLE readPipe[2], writePipe[2];
42 #endif
43  int status;
44  BOOL atEndOfStream;
45 }
46 
55 + (instancetype)processWithProgram: (OFString*)program;
56 
66 + (instancetype)processWithProgram: (OFString*)program
67  arguments: (OFArray*)arguments;
68 
80 + (instancetype)processWithProgram: (OFString*)program
81  programName: (OFString*)programName
82  arguments: (OFArray*)arguments;
83 
92 - initWithProgram: (OFString*)program;
93 
103 - initWithProgram: (OFString*)program
104  arguments: (OFArray*)arguments;
105 
117 - initWithProgram: (OFString*)program
118  programName: (OFString*)programName
119  arguments: (OFArray*)arguments;
120 
128 - (void)closeForWriting;
129 @end