NSPipe can be used for that sort of thing, I think, but it's not always exactly simple. I've tried a couple of times to make a wrapper for ftp, and capturing stdout right is tricky for some reason. It keeps not wanting to print to stdout until it terminates, and then it has trouble printing file listings of more than a few lines. I think this is the sort of thing NSPipes are for, though, so I assume I'm just not doing something right. I'll have to go over my code later to see if I can find out what's going wrong.
Anyway, sorry for not being especially helpful. I don't know that much about them, but I figured any response would probably be more informative than none.