ObjFW  Check-in [d605361c8b]

Overview
Comment:OFProcess: Make programName and arguments optional init arguments.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: d605361c8bbec0599b7c0f12d0ce5ecec5c4bc3bf761f2a44b762385fb3f45ce
User & Date: js on 2011-10-11 22:35:38
Other Links: manifest | tags
Context
2011-10-12
14:26
Use the new GNU API if gcc >= 4.7. check-in: 3e3f49406a user: js tags: trunk
2011-10-11
22:35
OFProcess: Make programName and arguments optional init arguments. check-in: d605361c8b user: js tags: trunk
22:30
Make it possible to close an OFProcess for writing. check-in: 88a34646a4 user: js tags: trunk
Changes

Modified src/OFProcess.h from [49a6b170dc] to [de525c3e8f].

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
{
	pid_t pid;
	int readPipe[2], writePipe[2];
	int status;
	BOOL atEndOfStream;
}























/**
 * \brief Creates a new OFProcess with the specified program, program name and
 *	  arguments and invokes the program.
 *
 * \param program The program to execute. If it does not start with a slash, the
 *		  search path specified in PATH is used.
 * \param programName The program name for the program to invoke (argv[0]).
 *		      Usually, this is equal to program.
 * \param arguments The arguments to pass to the program, or nil
 * \return A new, autoreleased OFProcess.
 */
+ processWithProgram: (OFString*)program
	 programName: (OFString*)programName
	   arguments: (OFArray*)arguments;

/**
 * \brief Initializes an already allocated OFProcess with the specified






















 *	  program, program name and arguments and invokes the program.
 *
 * \param program The program to execute. If it does not start with a slash, the
 *		  search path specified in PATH is used.
 * \param programName The program name for the program to invoke (argv[0]).
 *		      Usually, this is equal to program.
 * \param arguments The arguments to pass to the program, or nil
 * \return An initialized OFProcess.







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
















|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
|







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
93
94
95
96
97
98
99
100
{
	pid_t pid;
	int readPipe[2], writePipe[2];
	int status;
	BOOL atEndOfStream;
}

/**
 * \brief Creates a new OFProcess with the specified program and invokes the
 *	  program.
 *
 * \param program The program to execute. If it does not start with a slash, the
 *		  search path specified in PATH is used.
 * \return A new, autoreleased OFProcess.
 */
+ processWithProgram: (OFString*)program;

/**
 * \brief Creates a new OFProcess with the specified program and arguments and
 *	  invokes the program.
 *
 * \param program The program to execute. If it does not start with a slash, the
 *		  search path specified in PATH is used.
 * \param arguments The arguments to pass to the program, or nil
 * \return A new, autoreleased OFProcess.
 */
+ processWithProgram: (OFString*)program
	   arguments: (OFArray*)arguments;

/**
 * \brief Creates a new OFProcess with the specified program, program name and
 *	  arguments and invokes the program.
 *
 * \param program The program to execute. If it does not start with a slash, the
 *		  search path specified in PATH is used.
 * \param programName The program name for the program to invoke (argv[0]).
 *		      Usually, this is equal to program.
 * \param arguments The arguments to pass to the program, or nil
 * \return A new, autoreleased OFProcess.
 */
+ processWithProgram: (OFString*)program
	 programName: (OFString*)programName
	   arguments: (OFArray*)arguments;

/**
 * \brief Initializes an already allocated OFProcess with the specified program
 *	  and invokes the program.
 *
 * \param program The program to execute. If it does not start with a slash, the
 *		  search path specified in PATH is used.
 * \return An initialized OFProcess.
 */
- initWithProgram: (OFString*)program;

/**
 * \brief Initializes an already allocated OFProcess with the specified program
 *	  and arguments and invokes the program.
 *
 * \param program The program to execute. If it does not start with a slash, the
 *		  search path specified in PATH is used.
 * \param arguments The arguments to pass to the program, or nil
 * \return An initialized OFProcess.
 */
- initWithProgram: (OFString*)program
	arguments: (OFArray*)arguments;

/**
 * \brief Initializes an already allocated OFProcess with the specified program,
 *	  program name and arguments and invokes the program.
 *
 * \param program The program to execute. If it does not start with a slash, the
 *		  search path specified in PATH is used.
 * \param programName The program name for the program to invoke (argv[0]).
 *		      Usually, this is equal to program.
 * \param arguments The arguments to pass to the program, or nil
 * \return An initialized OFProcess.

Modified src/OFProcess.m from [7e13a65e14] to [3ee20593c1].

26
27
28
29
30
31
32












33
34
35
36
37
38
39
40















41
42
43
44
45
46
47
#import "OFArray.h"

#import "OFInitializationFailedException.h"
#import "OFReadFailedException.h"
#import "OFWriteFailedException.h"

@implementation OFProcess












+ processWithProgram: (OFString*)program
	 programName: (OFString*)programName
	   arguments: (OFArray*)arguments
{
	return [[[self alloc] initWithProgram: program
				  programName: programName
				    arguments: arguments] autorelease];
}
















- initWithProgram: (OFString*)program
      programName: (OFString*)programName
	arguments: (OFArray*)arguments
{
	self = [super init];








>
>
>
>
>
>
>
>
>
>
>
>








>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







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
#import "OFArray.h"

#import "OFInitializationFailedException.h"
#import "OFReadFailedException.h"
#import "OFWriteFailedException.h"

@implementation OFProcess
+ processWithProgram: (OFString*)program
{
	return [[[self alloc] initWithProgram: program] autorelease];
}

+ processWithProgram: (OFString*)program
	   arguments: (OFArray*)arguments
{
	return [[[self alloc] initWithProgram: program
				    arguments: arguments] autorelease];
}

+ processWithProgram: (OFString*)program
	 programName: (OFString*)programName
	   arguments: (OFArray*)arguments
{
	return [[[self alloc] initWithProgram: program
				  programName: programName
				    arguments: arguments] autorelease];
}

- initWithProgram: (OFString*)program
{
	return [self initWithProgram: program
			 programName: program
			   arguments: nil];
}

- initWithProgram: (OFString*)program
	arguments: (OFArray*)arguments
{
	return [self initWithProgram: program
			 programName: program
			   arguments: arguments];
}

- initWithProgram: (OFString*)program
      programName: (OFString*)programName
	arguments: (OFArray*)arguments
{
	self = [super init];