Re: Using NSTask to execute softwareupdate
Colin Swelin <[email protected]> Sat, 8 Jan 2011 12:59:08 -0500
| Newsgroups | gmane.comp.macosx.devel |
|---|---|
| Message-ID | <[email protected]> |
Here's the basic NSTask stuff:
NSPipe *pipes = [NSPipe pipe];
NSTask* patchInstall = [[NSTask alloc] init];
[patchInstall setLaunchPath:@
"/usr/sbin/softwareupdate"];
[patchInstall setArguments:[NSArray arrayWithObjects:@"-i", [patch
objectForKey:@"patch_identifier"], nil]];
[patchInstall setStandardOutput: pipes];
NSFileHandle *file = [pipes fileHandleForReading];
[patchInstall launch];
NSData *data = [file readDataToEndOfFile];
[patchInstall waitUntilExit];
......
[patchInstall release];
So i'm waiting for the task to complete, then I do my thing with the
results.
Thanks,
Colin
On Sat, Jan 8, 2011 at 12:48 PM, Tom Jones <[email protected]> wrote:
> Hi Colin,
> I would need to see your NSTask code, to really know. Are you using
> notifications as data becomes available or are you waiting until the task
> has completed?
>
>
> Thanks,
> tom
>
>
> On Jan 6, 2011, at 8:54 AM, Colin Swelin wrote:
>
> > Hi,
> >
> > I"m currently using NSTask to execute softwareupdate to install patches,
> however, there's a few patches that seem to hang when trying to install. For
> example, the latest 10.6.6 update and a older iTunes patch, everything else
> seems to work perfectly fine.
> >
> > Anyone have any clues to why this might happen? I've set the
> "COMMAND_LINE_INSTALL" environment variable to 1, so i'm a little confused
> to why this is happening.
> >
> > Thanks._______________________________________________
> > MacOSX-dev mailing list
> > [email protected]
> > http://www.omnigroup.com/mailman/listinfo/macosx-dev
>
>