• 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: Yet another problem with NSTask and NSPipe
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Yet another problem with NSTask and NSPipe


  • Subject: Re: Yet another problem with NSTask and NSPipe
  • From: Thomas Engelmeier <email@hidden>
  • Date: Sun, 22 Apr 2007 16:07:48 +0200


Am 22.04.2007 um 14:16 schrieb Dragan Milić:

Preample: I've used NSPipe'd NSTasks successfully on 2 GHz CoreDuo machines w/o any problem, even for short running processes. It was rather tricky, though, to get piping between tasks right (data got lost until the order was waterproof). You ARE already piping (/usr/ bin/env << hdiutil), I'd eliminate this for testing

NSTask *task = [[[NSTask alloc] init] autorelease];
[...]
	[task launch];
	[task waitUntilExit];
	int terminationStatus = [task terminationStatus];

Bug here: task is autoreleased:
Bug 2: You can NOT be sure all data was already received here, but the pipe will be terminated here


	[task release];
	if (terminationStatus != 0) {
		// error handling
	}

ous approaches and everything that I could find on mailing lists on NSTask and NSPipe topics and that I could think of, including pooling file descriptor of stdOutHandle with select() and setting it to O_NONBLOCK, reading in separate thread, putting delays in the main method, postponing removing of object from notification center until later,
postponing releasing of NSTask object until later,... None of it helped.

Take the Moriarty sample and modify it for your NSTask

Can anyone point to me the correct way of doing this, which will discard all possible timing issues? Any help is much appreciated.

Pretty complex, actually, especially if you also allow cancelling the NSTask.


Regards,
	Tom_E_______________________________________________

Cocoa-dev mailing list (email@hidden)

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: Yet another problem with NSTask and NSPipe
      • From: Dragan Milić <email@hidden>
References: 
 >Yet another problem with NSTask and NSPipe (From: Dragan Milić <email@hidden>)

  • Prev by Date: Re: Yet another problem with NSTask and NSPipe
  • Next by Date: Re: Yet another problem with NSTask and NSPipe
  • Previous by thread: Re: Yet another problem with NSTask and NSPipe
  • Next by thread: Re: Yet another problem with NSTask and NSPipe
  • Index(es):
    • Date
    • Thread