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: Uli Kusterer <email@hidden>
- Date: Sun, 22 Apr 2007 14:47:50 +0200
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.
[[NSNotificationCenter defaultCenter]
removeObserver:self
name:NSFileHandleReadCompletionNotification
object:nil];
Shouldn't that object be your file handle again?
Maybe the following helps: Here's what I used to mount an image and
read hdiutil's output into a file:
NSString* tempFile = [[NSFileManager defaultManager]
nameForTempFile];
NSTask* theTask = [[[NSTask alloc] init] autorelease];
[theTask setLaunchPath: @"/usr/bin/hdiutil"];
[theTask setArguments: [NSArray arrayWithObjects: @"attach", fpath,
@"-plist", @"-private", @"-nobrowse", nil]];
[[NSFileManager defaultManager] createFileAtPath: tempFile contents:
[NSData data] attributes: nil];
[theTask setStandardOutput: [NSFileHandle
fileHandleForWritingAtPath: tempFile]];
[theTask launch];
[theTask waitUntilExit];
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...
Cheers,
-- M. Uli Kusterer
http://www.zathras.de
_______________________________________________
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