Skip navigation.
 
mlRe: NSTask Permission denied
FROM : Sherm Pendley
DATE : Sat Nov 20 11:41:41 2004

On Nov 19, 2004, at 6:06 PM, John C. Randolph wrote:

> On Jul 21, 2004, at 8:11 PM, Jim Ways wrote:
>

>> I get the following dump when i attempt to use [NSTask
>> launch]. I want to launch a UEF under libary but i
>> cant even seem to lauch anything in applications.
>>
>> runtime = [[NSTask alloc] init];
>> [runtime setLaunchPath:
>> @"/Applications/TextEdit.app"];
>> [runtime launch];
>>
>>  *** NSTask: Task create for path
>> /Applications/TextEdit.app failed: 13, "Permission
>> denied".
>>
>> Any ideas? Thanks Guys!


> Do you actually need to launch TextEdit as a sub-process, or would
> NSWorkspace's -launchApplication: API suffice?
>
> -jcr
>


John's question is spot-on - if NSWorkspace will work for you, it's
probably better to use it.

But, if you really want to launch a child process for some reason, the
problem with the code above is that it's trying to execute a directory.
You need to specify the path to the binary inside the .app bundle if
you want to run it.

Alternatively, you could run /usr/bin/open with NSTask, and pass it two
arguments: "-a", "TextEdit". That's probably a better choice, as it
doesn't rely on the directory layout within the .app bundle.

sherm--

Related mailsAuthorDate
mlNSTask Permission denied Jim Ways Jul 22, 05:11
mlRe: NSTask Permission denied Shawn Erickson Jul 22, 05:45
mlRe: NSTask Permission denied David Reed Jul 22, 05:50
mlRe: NSTask Permission denied John C. Randolph Nov 20, 00:06
mlRe: NSTask Permission denied Sherm Pendley Nov 20, 11:41