Oh crap, NOW I get it. :P You don't have to do the fork dance at all.

Just call -setStandardInput: and pass /dev/stdin as the filename
argument. Let NSTask take care of the rest.

--Kyle Sluder

On Wed, Feb 20, 2013, at 08:30 PM, Jens Alfke wrote:
> 
> On Feb 20, 2013, at 8:22 PM, Kyle Sluder <k...@ksluder.com> wrote:
> 
> > You can accomplish this without writing to the file system, but it
> > involves foregoing NSTask. Fork, close stdin in the child process, open
> > a pipe (so that the child gets the read end in fd 0), then exec the tool
> > with "/dev/stdin" as the filename argument.
> 
> D’ohh! I’d forgotten about /dev/stdin. But why does this require
> abandoning NSTask? Its API supports redirecting input/output. Just call
> -[NSTask setStandardInput:].
> 
> —JEns

_______________________________________________

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