• 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
Re: Yet another problem with NSTask and NSPipe
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Yet another problem with NSTask and NSPipe
      • From: Dragan Milić <email@hidden>
References: 
 >Yet another problem with NSTask and NSPipe (From: Dragan Milić <email@hidden>)

  • Prev by Date: Yet another problem with NSTask and NSPipe
  • Next by Date: Re: Yet another problem with NSTask and NSPipe
  • Previous by thread: Yet another problem with NSTask and NSPipe
  • Next by thread: Re: Yet another problem with NSTask and NSPipe
  • Index(es):
    • Date
    • Thread