Re: More on NSTask and output to NSTextView
Re: More on NSTask and output to NSTextView
- Subject: Re: More on NSTask and output to NSTextView
- From: "Louis C. Sacha" <email@hidden>
- Date: Sun, 6 Jun 2004 17:39:40 -0700
Hello...
You would need to add an instance variable somewhere to hold the
data, but as you recieve the data you could just add it to an object
used as a buffer (either as a string or as the raw data), and only
update the string in the NSTextView once you have recieved the empty
data object that indicates the end of the data...
Louis
Hi,
Thanks to all the good suggestions on the list I am now using an
NSTask to launch a commandline program in a GUI. It all works very
nice except displaying the output from the program in an NSTextView
is displayed in chunks. After searching the archives it seems that
this is caused by the NSTask - NSPipe - NSFileHandle combination
that does some buffering. This has been discussed before and the
general suggestion to prevent this is to use
readInBackgroundAndNotify on the NSFileHandle. Here is a snippet:
...
However, the data is still displayed in chunks. It must be possible,
because when I don't send the output to the NSPipe, the ouput goes
to the console window of XCode and there the output scrolls nicely
over the screen without any hickups.
I also tried Moriarity and the AMTextShellWrapper, but the results
are still the same.
Any suggestions how to improve this?
thanks,
- Koen.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.