I am having weird results with NSTask. It sometimes retrieves the output, and 
other times receives nothing.

I have example code for this issue at 
https://dl.dropbox.com/u/610721/NSTask%20Issue.zip

The result I have is below:

0 Starting
0 Received /bin/ls
0 Done
1 Starting
1 Received
1 Done
2 Starting
2 Received
2 Done
3 Starting
3 Received
3 Done
4 Starting
4 Received
4 Done
5 Starting
5 Received
5 Done
6 Starting
6 Received /bin/ls
6 Done
7 Starting
7 Received
7 Done
8 Starting
8 Received (null)
8 Done
9 Starting
9 Received (null)
9 Done
10 Starting
10 Received /bin/ls
10 Done
11 Starting
11 Received /bin/ls
11 Done
12 Starting
12 Received
12 Done
13 Starting
13 Received
13 Done
14 Starting
14 Received /bin/ls
14 Done
15 Starting
15 Received /bin/ls
15 Done
16 Starting
16 Received /bin/ls
16 Done
17 Starting
17 Received /bin/ls
17 Done
18 Starting
18 Received /bin/ls
18 Done
19 Starting
19 Received /bin/ls
19 Done

In the sample, I have sorted it out per the task which was started. Received is 
any stderr or stdin output from the task ran. In this example, I am running 
"/usr/bin/which ls" as it's simple and runs quickly.

My thinking is there is some sort of buffer on the NSPipe and by the time the 
task quits, the buffer ether didn't receive the data or it hasn't prepared it 
for sending the notification.

Can anyone help me out with this issue? It's been bugging me for hours.

Thanks,
Mr. Gecko
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to