Hi,
I can't find a way in Cocoa to mount a dmg disk.
So I would try to call the shell through a NSTask.
I succeed on the Terminal when executing this command line:

echo -n password | hdiutil mount /Users/john/Documents/MyDmgDisk.dmg

But when I pass this command line to the NSTask, I fail all the time.
Furthermore, the app stops to output my NSLog messages to the XCode console.
Please, what do I miss?

NSString    *commandLine = @"echo -n password | hdiutil mount
/Users/john/Documents/MyDmgDisk.dmg";

  NSArray     *args = [NSArray arrayWithObjects:@"-c",  commandLine , nil];
  NSTask        *task = [[NSTask alloc] init];
  [task setLaunchPath:@"/bin/sh"];
  [task setArguments:args];
  [task setStandardOutput:[NSFileHandle fileHandleWithNullDevice]];
  [task setStandardError:[NSFileHandle fileHandleWithStandardError]];
  [task launch];
  [task waitUntilExit];
  int result = [task terminationStatus];
  [task release];


Please note, in case of no password, I simply call
    system("hdiutil mount Users/john/Documents/MyDmgDisk.dmg");
and it works well all the time. But even here, I don't know how to deal with
the password. Any idea?


Regards
--
Leo


_______________________________________________

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to