June 2004

How to handle interactivity with a command line tool from a Cocoa program ?

I am trying to communicate with a command line tool launched as a NSTask from my Cocoa application but I run into various difficulties to get the prompts and other outputs of the tool and to supply user input correctly.
Is there a solution ?

How to tell if executing on the main thread ?

How can I tell if the currently executing code is on the main thread or a secondary thread?

Is it necessary to create a new NSAutoreleasePool in detached threads ?

How to use correctly NSAutoreleasePool in NSThread ?
What is the best strategy ?