• 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
Does waitUntilExit really mean that?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Does waitUntilExit really mean that?


  • Subject: Does waitUntilExit really mean that?
  • From: Michael Domino <email@hidden>
  • Date: Mon, 6 Apr 2009 13:47:36 -0400

Hi all,

Thanks for all the advice about how to make my pipe reads non- blocking, that works almost perfectly. I have a class now that handles the notifications (called msgTarget in the code snippet below). The puzzle here is the meaning of "waitUntilExit". My hdiutil info task was returning no data in both the output and error file handles. When I put in sleep(1), I started to get error strings, but no output strings. When I increased the wait to sleep(3), my standard output started coming through. Why would this be the case if waitUntilExit is actually waiting until the hdiutil task completes and exits? Is there some other latency in this process that my sleep() accounts for? I'd rather not rely on a kludge like this to get my output string. Is the problem using readToEndOfFileInBackgroundAndNotify instead of readInBackgroundAndNotify? I tried the latter call, but seem to get better results using readToEndOfFileInBackgroundAndNotify (or is that totally the wrong thing to do?).


[task setLaunchPath:@"/usr/bin/hdiutil"];
[task setArguments:[NSArray arrayWithObjects:@"info", nil]];
[task setStandardError:messagePipeError];
[task setStandardOutput:messagePipeOutput];
NSFileHandle* readHandleError = [messagePipeError fileHandleForReading];
[msgTarget setReadHandleError:readHandleError];
NSFileHandle* readHandleOutput = [messagePipeOutput fileHandleForReading];
[msgTarget setReadHandleOutput:readHandleOutput];
[readHandleError readToEndOfFileInBackgroundAndNotify];
[readHandleOutput readToEndOfFileInBackgroundAndNotify];
[task launch];
sleep(3);
[task waitUntilExit];
status = [task terminationStatus];


Thanks for your help,
Michael

Michael Domino
email@hidden



Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________

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

  • Follow-Ups:
    • Re: Does waitUntilExit really mean that?
      • From: Michael Ash <email@hidden>
    • Re: Does waitUntilExit really mean that?
      • From: Ken Thomases <email@hidden>
  • Prev by Date: Re: Non-pageable app
  • Next by Date: Re: Non-pageable app
  • Previous by thread: Re: Re: NSWindow from code
  • Next by thread: Re: Does waitUntilExit really mean that?
  • Index(es):
    • Date
    • Thread