Re: NSTask is Weird
Re: NSTask is Weird
- Subject: Re: NSTask is Weird
- From: "Sherm Pendley" <email@hidden>
- Date: Thu, 11 Sep 2008 08:53:17 -0400
On Thu, Sep 11, 2008 at 7:03 AM, J. Todd Slack <
email@hidden> wrote:
> Hi,
>
> I guess what I dont get is when you pass arguments that are not simple
> like:
>
> [task setLaunchPath: @"/bin/ls"];
>> [task setArguments: [NSArray arrayWithObjects: @"ls", @"-al", @"/",
>> nil]];
>>
>
> What about a command that takes arguments like:
>
> --segments /Users/slack/music/iTunes/iTunes Music/amber,00:00:10,00:00:35
> /user/slack/music/itunes/itunes music/01 amber.mp3
>
> Where:
>
> ' --segments' is an argument
>
> '/Users/slack/music/iTunes/iTunes Music/amber,00:00:10,00:00:35' is really
> one argument I build up from pieces and has spaces in path
>
> '/user/slack/music/itunes/itunes music/01 amber.mp3' is another argument
> with spaces in path, etc
What's not to get? Spaces are only a problem if you're passing the whole
command to a shell; in that case, the shell will normally interpret them as
argument delimiters, so you have to quote arguments that include spaces in
them to avoid that.
With NSTask there's no shell involved; arguments are passed directly to the
child process. So you don't have to quote anything, or escape &, > or any
other characters that have "special" meaning to the shell.
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
_______________________________________________
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