• 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: NSTask output reading problem
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSTask output reading problem


  • Subject: Re: NSTask output reading problem
  • From: Ondra Cada <email@hidden>
  • Date: Sat, 24 Apr 2004 13:32:07 +0200

On 24.4.2004, at 12:20, Jean Bovet wrote:

> [task launch];
>
> [taskOutput readInBackgroundAndNotify];
> [errorOutput readInBackgroundAndNotify];

What about switching them? First schedule readInBackgroundAndNotify,
then launch the task. Otherwise, it looks about right -- such a code
works for me in may apps all right.

> if (incomingData && [incomingData length]>0) {

This is unnecessary: thanks to ObjC smart design, "if ([incomingData
length]>0)" would work just as well. You need a separate check for nil
only in cases the method may return float, struct, or generally
anything unconvertible to int.
---
Ondra Hada
OCSoftware: email@hidden http://www.ocs.cz
private email@hidden http://www.ocs.cz/oc

[demime 0.98b removed an attachment of type application/pkcs7-signature which had a name of smime.p7s]
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.


References: 
 >NSTask output reading problem (From: Jean Bovet <email@hidden>)

  • Prev by Date: Re: Programmatically creating NSButton
  • Next by Date: Re: Programmatically creating NSButton
  • Previous by thread: NSTask output reading problem
  • Next by thread: Formatting the cells in NSTableView
  • Index(es):
    • Date
    • Thread