1
2
3
4
5
6
7
8
9
|
/*
* Copyright (c) 2008-2022 Jonathan Schleifer <js@nil.im>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
|
|
|
1
2
3
4
5
6
7
8
9
|
/*
* Copyright (c) 2008-2023 Jonathan Schleifer <js@nil.im>
*
* All rights reserved.
*
* This file is part of ObjFW. It may be distributed under the terms of the
* Q Public License 1.0, which can be found in the file LICENSE.QPL included in
* the packaging of this file.
*
|
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#import "OFInitializationFailedException.h"
#import "OFNotOpenException.h"
#import "OFOutOfRangeException.h"
#import "OFReadFailedException.h"
#import "OFWriteFailedException.h"
#ifndef HAVE_POSIX_SPAWNP
extern char **environ;
#endif
@interface OFSubprocess ()
- (void)of_getArgv: (char ***)argv
forProgramName: (OFString *)programName
andArguments: (OFArray *)arguments;
|
|
|
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
#import "OFInitializationFailedException.h"
#import "OFNotOpenException.h"
#import "OFOutOfRangeException.h"
#import "OFReadFailedException.h"
#import "OFWriteFailedException.h"
#if !defined(HAVE_POSIX_SPAWNP) || !defined(HAVE_SPAWN_H)
extern char **environ;
#endif
@interface OFSubprocess ()
- (void)of_getArgv: (char ***)argv
forProgramName: (OFString *)programName
andArguments: (OFArray *)arguments;
|
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
path = [program cStringWithEncoding: [OFLocale encoding]];
[self of_getArgv: &argv
forProgramName: programName
andArguments: arguments];
@try {
env = [self of_environmentForDictionary: environment];
#ifdef HAVE_POSIX_SPAWNP
posix_spawn_file_actions_t actions;
posix_spawnattr_t attr;
if (posix_spawn_file_actions_init(&actions) != 0)
@throw [OFInitializationFailedException
exceptionWithClass: self.class];
|
|
|
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
|
path = [program cStringWithEncoding: [OFLocale encoding]];
[self of_getArgv: &argv
forProgramName: programName
andArguments: arguments];
@try {
env = [self of_environmentForDictionary: environment];
#if defined(HAVE_POSIX_SPAWNP) && defined(HAVE_SPAWN_H)
posix_spawn_file_actions_t actions;
posix_spawnattr_t attr;
if (posix_spawn_file_actions_init(&actions) != 0)
@throw [OFInitializationFailedException
exceptionWithClass: self.class];
|