Take the 2-minute tour ×

I'm using NSTask and NSPipe to execute a command and asynchronously get its output.

The code I'm using is almost 100% the same as in my question, here (with the fixes included).

However, while I'm testing it, I noticed that some times, the NSTaskDidTerminateNotification comes several milliseconds BEFORE the last NSFileHandleReadCompletionNotification.

In other words, the seemingly dead task is sending me data AFTER it has been terminated.

What's going wrong? Any ideas?

share|improve this question
Nothing is wrong. If the pipe is only closed when the task ends, it is impossible to know which notification you will get first. –  ughoavgfhw Apr 22 '12 at 17:29

1 Answer 1

up vote 0 down vote accepted

As @ughoavgfhw mentioned : it turns out there really was no issue.

share|improve this answer

Your Answer


