On 04/04/2008, Randall Meadows <[EMAIL PROTECTED]> wrote: > I'm having problems with what should be a simple NSTask invocation: > > NSArray *args = [NSArray arrayWithObjects: > @"-cf", > [NSString stringWithFormat:@"\"[EMAIL PROTECTED]"", tarFilePath], > [NSString stringWithFormat:@"\"[EMAIL PROTECTED]"", plistPath], > nil]; > tarTask = [NSTask launchedTaskWithLaunchPath:@"/usr/bin/tar" > arguments:args]; > [tarTask waitUntilExit]; > int status = [tarTask terminationStatus]; > > After all that, status = 2. > > I've tried making the arguments only 1 entry in the array, and the same > thing; I've both quoting and not quoting the arguments, and the same thing; > I've tried using a dash with the options and without, and the same > thing--always status=2 (fatal error). > > tarFilePath and plistPath are full paths, and valid ones at that. > > I can take the contents of all that and do it on the command line and that > works. What in the world am I missing here that is causing it to fail?
I do something very similar. The only difference is I'm not constructing a path via stringWithFormat. I'm using either NSString's "fileSystemRepresentation" or NSURL's "path" method to get a well formed path to pass in as a parameter... So I wonder what your stringWithFormat results actually look like. Hey wait... why does your tarFilePath end with a "/", isn't that the equivalent of doing a tar cf ~/tmp/archive.tar/ /{blah}/SourceFolder/ ??? That will bork for sure... Also are you sure that plistPath is a directory? It will sure look that way to "tar". Do try the fileSystemRepresentation method :-) Cheers, -H. _______________________________________________ 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 [EMAIL PROTECTED]