Re: Yet another problem with NSTask and NSPipe
Re: Yet another problem with NSTask and NSPipe
- Subject: Re: Yet another problem with NSTask and NSPipe
- From: Dragan Milić <email@hidden>
- Date: Sun, 22 Apr 2007 15:03:47 +0200
On ned 22. 04. 2007., at 14:47, Uli Kusterer wrote:
Don't really have an idea what causes this. Just a few oddities
with your code:
Am 22.04.2007 um 14:16 schrieb Dragan Milić:
[task setArguments:[NSArray arrayWithObjects:@"hdiutil",
@"imageinfo", @"-plist", imageName, nil]];
[task setLaunchPath:@"/usr/bin/env"];
Isn't this a little odd? I'd expect you to be using /usr/bin/
hdiutil (or whatever) as the launch path, and not pass hdiutil as
the first parameter.
One can use both approaches, not really related to the problem I have.
[[NSNotificationCenter defaultCenter]
removeObserver:self
name:NSFileHandleReadCompletionNotification
object:nil];
Shouldn't that object be your file handle again?
From the documentation:
"notificationName: Name of the notification to remove from dispatch
table. Specify a notification name to remove only entries that
specify this notification name. When nil, the receiver does not use
notification names as criteria for removal.
notificationSender: Sender to remove from the dispatch table. Specify
a notification sender to remove only entries that specify this
sender. When nil, the receiver does not use notification senders as
criteria for removal."
What I do is unregistering an object as observer from all entries
that specify NSFileHandleReadCompletionNotification as notification
name, hence including my file handle I previously registered the
object with. Again, one can use both approaches in this case, not
related to the problem.
Maybe that helps you find out what you're doing different? Though I
personally don't see many differences apart from that I don't use a
pipe...
That's a "gotcha". Using pipe is what makes the whole thing tricky. I
don't have any problems getting the output into a file.
Milke
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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