Re: NSTask is Weird
Re: NSTask is Weird
- Subject: Re: NSTask is Weird
- From: Jim Correia <email@hidden>
- Date: Thu, 11 Sep 2008 01:13:51 -0400
On Sep 11, 2008, at 12:12 AM, Andrew Farmer wrote:
Arguments needs to be an array containing one element per argument
to the task
That is correct.
including argv[0] as the name of the executable.
That advice is incorrect for NSTask.
Consider the output of the following code, which follows that
incorrect advice:
#import <Foundation/Foundation.h>
int main (int argc, const char * argv[])
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSTask *task = [[NSTask alloc] init];
[task setLaunchPath: @"/bin/ls"];
[task setArguments: [NSArray arrayWithObjects: @"ls", @"-al", @"/",
nil]];
[task launch];
[task waitUntilExit];
[pool drain];
return 0;
}
Jim
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden