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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to