The below is an off-site archive of all tweets posted by @mjtsai ever

May 15th, 2015

50% off Domain-Driven Design today: informit.com/deals/

via Tweetbot for Mac

@czechboy0 No time for that at the moment, but maybe I can write a blog post sometime.

via Tweetbot for Mac in reply to czechboy0

@czechboy0 But note that you can get NSTaskDidTerminateNotification before the last NSFileHandleReadCompletionNotification…

via Tweetbot for Mac in reply to czechboy0

@czechboy0 I guess if you want to be safer you could wait until you also get a NSTaskDidTerminateNotification.

via Tweetbot for Mac in reply to czechboy0

@czechboy0 As far as I know, that's the best way to do it. I wonder if a script could purposely close its pipes before it finishes?

via Tweetbot for Mac in reply to czechboy0

@czechboy0 No, because instead of calling -waitUntilExit you run your own loop until the output and error are finished.

via Tweetbot for Mac in reply to czechboy0

@czechboy0 Build up the output/error data a chunk at a time. Don't -waitUntilExit. Keep running the run loop until file handles are empty.

via Tweetbot for Mac in reply to czechboy0

@czechboy0 As I recall, -waitUntilExit will just hang. Solution is to register both file handles for read completion notifications.

via Tweetbot for Mac in reply to czechboy0

@czechboy0 Looks like this doesn't handle the case where the task never terminates because the output pipe buffer gets filled up.

via Tweetbot for Mac in reply to czechboy0