Mac NSTask Question

I am developing a multimedia Mac software, but after running several NSTasks, the program reports an error. The error code is
[NSConcreteTask launchWithDictionary:error:].
I make sure that the thread is brand new and not occupied. I need some solutions.Thanks you.
It doesn't look like you provided the full error. The thread doesn't need to be "new", you can launch a task on any thread, but some of the functionality will require a running runloop.
https://developer.apple.com/forums/thread/660011?answerId=632151022#632151022
Thank you for your reply. But crash did not provide me with more effective information, only provided below code
0 libsystem_kernel.dylib 0x00007fff7113c41e dup + 10
1 com.apple.Foundation 0x00007fff39738552 -[NSConcreteTask launchWithDictionary:error:] + 2514

But crash did not provide me with more effective information, only
provided below code

If you run the app outside of Xcode, does it still crash? If so, that should generate a crash report. Please grab that and post it here (as a text attachment so it doesn’t flood the timeline).

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@apple.com"
Given the crash is in dup(2) called during -launchWithDictionary:error:, the crash is mostly likely EXC_GUARD GUARD_TYPE_FD, which means you're doing things with system-protected descriptors that you shouldn't. This would include reopening things already open, closing descriptors which don't belong to you, etc. Since you're using NSTask, it would be through NSFileHandle, and if you're launching lots of processes (simultaneously, or over time) you probably have a race condition based on incorrect usage of -closeFile (read the documentation of @standardInput) or you're creating them from raw descriptors but not keeping track of them.
Mac NSTask Question
 
 
Q