• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSTask setStandardInput screws up notifications
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

NSTask setStandardInput screws up notifications


  • Subject: NSTask setStandardInput screws up notifications
  • From: Ron Wagner <email@hidden>
  • Date: Wed, 2 Jul 2003 14:32:25 -0400

Hello list,

I am using NSTask in a Cocoa app and calling setStandardInput and
setStandardOutput to send data back and forth to the tool that I am
launching. The tool works fine when invoked from Terminal, but from the
Cocoa app my NSFileHandleReadCompletionNotification method stops
working when I call setStandardOutput. In other words, if I comment out
the call to setStandardOutput the notification works when the tool
sends data to stdout. As soon as I uncomment it out, no more
notification.

Here is the NSTask setup code. Any ideas would be appreciated.

Thanks,
Ron Wagner


[_spoolerTask setStandardOutput: [NSPipe pipe]];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(taskDataAvailable:)
name: NSFileHandleReadCompletionNotification
object: [[_spoolerTask standardOutput] fileHandleForReading]];
[[[_spoolerTask standardOutput] fileHandleForReading]
readInBackgroundAndNotify];

[_spoolerTask setStandardError: [NSPipe pipe]];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(errorDataAvailable:)
name: NSFileHandleReadCompletionNotification
object: [[_spoolerTask standardError] fileHandleForReading]];
[[[_spoolerTask standardError] fileHandleForReading]
readInBackgroundAndNotify];

_inputPipe = [NSPipe pipe];
_taskInput = [_inputPipe fileHandleForWriting];

// following line uncommented stops read notification
// [_spoolerTask setStandardInput: _inputPipe];
_______________________________________________
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.

  • Prev by Date: Anyone interested on taking a small project ??
  • Next by Date: Re: EOF undead?
  • Previous by thread: Anyone interested on taking a small project ??
  • Next by thread: makeWindowControllers
  • Index(es):
    • Date
    • Thread