Active Read/Write of NSTask
Active Read/Write of NSTask
- Subject: Active Read/Write of NSTask
- From: Kevin Ferguson <email@hidden>
- Date: Tue, 06 Oct 2009 16:30:11 -0700
Greetings,
I am working on an application that will allow the user to run a
command-line binary from within my program. This is a simple binary
written in C. To accomplish this, I am using NSTask to execute the
binary. I then output the result of the task to a text view in my program.
All of this works just fine using NSPipe and setting the standard
in/output of the task.
I am running into a problem when the binary to be executed contains a
scanf statement. I want the user to see results and type in input in
real time (like the debugger for standard C tools in xcode). The issue
is that as soon as the task hits the scanf statement, the read pipe
blocks, so I can't read from it to get data to that point, nor can I
tell when it blocks in order to prompt the user for input (preferably
using the output up to that point). I know it can be done, I am just
completely in the dark as to how/what classes to consider.
Any ideas on how to accomplish what I'm after?
-Kevin
_______________________________________________
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