determine whether an ancillary program/task can run
determine whether an ancillary program/task can run
- Subject: determine whether an ancillary program/task can run
- From: Martin Wierschin <email@hidden>
- Date: Thu, 01 Sep 2011 14:09:47 -0700
Hello all,
My application sometimes need to run an ancillary program (included in the app's resources). I do this via NSTask and normally it works great.
The problem is that this ancillary program is sometimes Intel-only, or sometimes PPC-only, while the main application is Universal. The use of this ancillary program is not mandatory, so displaying an error message, or using a fallback solution is acceptable. The issue is that trying to run an ancillary program on an unsupported architecture triggers a hard crash:
>> Exception Type: EXC_BREAKPOINT (SIGTRAP)
>> Exception Codes: 0x0000000000000001, 0x000000009030c0b0
>> Crashed Thread: 0
>>
>> Application Specific Information:
>> *** NSTask: Task create for path '.../Resources/mysubtool' failed: 86, "Bad CPU type in executable". Terminating temporary process.
>> *** multi-threaded process forked ***
>>
>> Thread 0 Crashed:
>> 0 com.apple.Foundation 0x9030c0b0 ___NEW_PROCESS_COULD_NOT_BE_EXECD___ + 0
>> 1 com.apple.Foundation 0x901d0354 -[NSConcreteTask launchWithDictionary:] + 2472
Is there an elegant way to catch this? I'd rather not try to figure out the arch of the ancillary program, host arch, and (if relevant) whether Rosetta is installed or not.
Thanks,
~Martin
_______________________________________________
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