On Aug 9, 2012, at 10:00 AM, Charlie Dickman <3tothe...@comcast.net> wrote:
> NSTask *ls = [[NSTask alloc] init]; > NSFileHandle *stdIn = [NSFileHandle > fileHandleForReadingAtPath: txtFilePath]; > [ls setStandardInput: stdIn]; > [ls setLaunchPath: @"/usr/bin/say"]; > [ls launch]; > [ls release]; > > My problem is that the command speaks the text in the file when the task is > launched but not anything written to it subsequently. Yeah, when the NSFileHandle hits EOF on the file it will propagate the EOF to the task, which will then exit. What you want instead is to make your own NSStream that isn't tied to a file. But looking at the NSTask and NSFileHandle APIs, I don't see how you can attach an NSStream to a task... (Basically, the stream APIs in Cocoa suck. I don't know why this is; they're so important, there's plenty of prior art, and most other frameworks like Java managed to do them pretty well. But working with streams in Cocoa apps is usually a total mess.) —Jens _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com