• 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: Reading data from an NSTask [SOLVED]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Reading data from an NSTask [SOLVED]


  • Subject: Re: Reading data from an NSTask [SOLVED]
  • From: Ken Tozier <email@hidden>
  • Date: Mon, 4 Jul 2005 20:53:50 -0400


On Jul 4, 2005, at 8:27 PM, mmalcolm crawford wrote:

On Jul 4, 2005, at 4:11 PM, Ken Tozier wrote:

NSTask            *testTask        = [[NSTask alloc] init];

autorelease?

Yeah. That would be better.

NSTask        *testTask        = [[[NSTask alloc] init] autorelease];

NSLog(@"task failed with error = %@", [[NSString alloc] initWithData: taskData encoding: NSUnicodeStringEncoding]);

This also leaks. It also seems "risky" if, say, the data size is in the megabyte range and fails just before completion. Moreover, the string encoding may well be something other than Unicode...

Since both testTask's "standardOutput" and "standardError" point to the same fileHandle, wouldn't an error flush the handle? I'm not very familiar with how the unix tools do stuff.


Re Unicode: That is wrong (at least for errors) it should be "NSUTF8StringEncoding." Saw that after pressing the send button.

Would this be better, risk-wise?

NSString *errMsg = [[NSString alloc] initWithData: taskData encoding: NSUTF8StringEncoding];
NSLog(@"task failed with error = %@", errMsg);
[errMsg release];



_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: Reading data from an NSTask [SOLVED]
      • From: Will Mason <email@hidden>
References: 
 >Re: Reading data from an NSTask (From: Mark Ackerman <email@hidden>)
 >Re: Reading data from an NSTask [SOLVED] (From: Ken Tozier <email@hidden>)
 >Re: Reading data from an NSTask [SOLVED] (From: mmalcolm crawford <email@hidden>)

  • Prev by Date: Re: Reading data from an NSTask [SOLVED]
  • Next by Date: Re: NSMetadataQueryResultContentRelevanceAttribute?
  • Previous by thread: Re: Reading data from an NSTask [SOLVED]
  • Next by thread: Re: Reading data from an NSTask [SOLVED]
  • Index(es):
    • Date
    • Thread