• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: NSTask is Weird
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: NSTask is Weird
      • From: "J. Todd Slack" <email@hidden>
References: 
 >NSTask is Weird (From: "J. Todd Slack" <email@hidden>)
 >Re: NSTask is Weird (From: Andrew Farmer <email@hidden>)

  • Prev by Date: Re: BOOL array
  • Next by Date: Re: How do people typically implement dialog controllers?
  • Previous by thread: Re: NSTask is Weird
  • Next by thread: Re: NSTask is Weird
  • Index(es):
    • Date
    • Thread