174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
|
if (posix_spawnattr_setflags(&attr,
POSIX_SPAWN_CLOEXEC_DEFAULT) != 0)
@throw [OFInitializationFailedException
exceptionWithClass: self.class];
# endif
if (posix_spawnp(&_pid, path, &actions, &attr,
argv, env) != 0)
@throw [OFInitializationFailedException
exceptionWithClass: self.class];
} @finally {
posix_spawn_file_actions_destroy(&actions);
posix_spawnattr_destroy(&attr);
}
#else
if ((_pid = vfork()) == 0) {
environ = env;
close(_readPipe[0]);
close(_writePipe[1]);
dup2(_writePipe[0], 0);
dup2(_readPipe[1], 1);
execvp(path, argv);
|
|
>
|
|
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
|
if (posix_spawnattr_setflags(&attr,
POSIX_SPAWN_CLOEXEC_DEFAULT) != 0)
@throw [OFInitializationFailedException
exceptionWithClass: self.class];
# endif
if (posix_spawnp(&_pid, path, &actions, &attr,
argv, (env != NULL ? env : environ)) != 0)
@throw [OFInitializationFailedException
exceptionWithClass: self.class];
} @finally {
posix_spawn_file_actions_destroy(&actions);
posix_spawnattr_destroy(&attr);
}
#else
if ((_pid = vfork()) == 0) {
if (env != NULL)
environ = env;
close(_readPipe[0]);
close(_writePipe[1]);
dup2(_writePipe[0], 0);
dup2(_readPipe[1], 1);
execvp(path, argv);
|