Re: trying to control the output of a subprocess.
Re: trying to control the output of a subprocess.
- Subject: Re: trying to control the output of a subprocess.
- From: Ingvar Nedrebo <email@hidden>
- Date: Fri, 5 Sep 2008 09:09:06 +0100
On Sep 4, 2008, at 03:53, Paul Archibald wrote:
Hey folks,
MyApp is a GUI to a command line program (CLP) to which I do not
have the source code. MyApp asks the user to select a directory,
makes a list of the files in that directory, and calls the CLP for
each file. The CLP processes the file(s), reporting its progress to
the console with a message like "filename : block 2 finished" until
it is finished "filename : finished." I use that output to inform
the progressbars and other elements of my GUI.
Well, it worked fine up until now, when I am doing some testing and
am launching MyApp from the Finder instead of from Xcode. Now, the
progress output is being buffered until the CPL is finished with the
file, and then spewing out the entire buffer (which MyApp has been
intercepting). This is abd for me since I need that line by line
output.
I have seen some posts on the Cocoa and Xcode lists that mention
similar problems, but I can't find one that explains how to fix it.
I am using the TaskWrapper class from the Moriarity sample to
execute my tasks. Here is how TaksWrapper sets up the NSTask that it
uses:
Paul,
If you want to try the pseudo-tty route, I wrote some example code a
while ago that demonstrates this. The code is very similar in
structure to Apple's Moriarity example, except for using pseudo-ttys
instead of pipes.
You can find PseudoTTY.zip at <http://idisk.mac.com/inedrebo>
i.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden