Re: NSTask failing
Re: NSTask failing
- Subject: Re: NSTask failing
- From: Randall Meadows <email@hidden>
- Date: Fri, 4 Apr 2008 15:43:42 -0600
On Apr 4, 2008, at 3:14 PM, Hamish Allan wrote:
NSArray *args = [NSArray arrayWithObjects: @"cfv", tarFilePath,
plistPath, nil];
tarTask = [[[NSTask alloc] init] autorelease];
[tarTask setLaunchPath:@"/usr/bin/tar"];
[tarTask setArguments:args];
NSPipe *resultsPipe = [NSPipe pipe];
NSFileHandle *resultsHandle = [resultsPipe fileHandleForReading];
[tarTask setStandardOutput:resultsPipe];
[tarTask setStandardError:resultsPipe];
NSData *data;
while ([((data = [resultsHandle availableData])) length] > 0)
{
NSString *s = [[NSString alloc] initWithData:data
encoding:NSASCIIStringEncoding];
NSLog(s);
}
[tarTask waitUntilExit];
I assume there was supposed to be a [tarTask launch] in there
somewhere, eh? :)
I am getting back a message: "/usr/bin/tar: Removing leading `/' from
member names"
I get that on the command line, too, but at least there, the result
code is 0.
And, as it turns out, without the quoted arguments, the task IS
SUCCESSFUL! WTH it is returning a FATAL ERROR as a result code is
beyond me. I had stopped looking in the Finder for the file when the
result code was consistently returning 2 (DOH!).
Now, I have no idea how I'm goint to detect an ACTUAL error condition;
I'm going to be subsequently adding to this tar archive, and if every
frickin' successful operation on it returns a fatal error, how do I
detect the unsuccessful fatal errors? :)
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden