1998-01-21 14:56:24 +00:00
|
|
|
#include <Foundation/NSAutoreleasePool.h>
|
1998-04-02 14:27:40 +00:00
|
|
|
#include <Foundation/NSProcessInfo.h>
|
1998-01-21 14:56:24 +00:00
|
|
|
#include <Foundation/NSTask.h>
|
|
|
|
|
|
|
|
int
|
|
|
|
main()
|
|
|
|
{
|
|
|
|
id pool;
|
1998-04-02 14:27:40 +00:00
|
|
|
NSDictionary *env;
|
1998-01-21 14:56:24 +00:00
|
|
|
NSTask *task;
|
|
|
|
|
|
|
|
pool = [[NSAutoreleasePool alloc] init];
|
|
|
|
|
|
|
|
task = [NSTask launchedTaskWithLaunchPath: @"/bin/ls"
|
|
|
|
arguments: nil];
|
|
|
|
[task waitUntilExit];
|
|
|
|
printf("Exit status - %d\n", [task terminationStatus]);
|
|
|
|
|
1998-04-02 14:27:40 +00:00
|
|
|
[pool release];
|
|
|
|
pool = [[NSAutoreleasePool alloc] init];
|
|
|
|
|
|
|
|
task = [NSTask new];
|
|
|
|
env = [[[[NSProcessInfo processInfo] environment] mutableCopy] autorelease];
|
|
|
|
[task setEnvironment: env];
|
|
|
|
[task setLaunchPath: @"/bin/sh"];
|
|
|
|
[task setArguments: [NSArray arrayWithObjects: @"-c", @"echo $PATH", nil]];
|
|
|
|
[task launch];
|
|
|
|
[task waitUntilExit];
|
|
|
|
[task release];
|
1998-01-21 14:56:24 +00:00
|
|
|
[pool release];
|
|
|
|
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
|