On Feb 20, 2013, at 4:18 PM, dangerwillrobinsondan...@gmail.com wrote:

> Is there a way to feed an NSTask argument data when the command line tool in 
> the task expects a file path argument?
> I would like to not actually create a file to use as the argument, but rather 
> send data that would be in said file. 
> Can this be done via NSFileHandle or NSPipe from NSData?

This isn’t really feasible, for reasons that have nothing to do with NSTask. 
The tool’s argument list is just an array of strings. The tool is going to 
interpret one of those strings as a filesystem path and do something that will 
end up asking the filesystem to open the file at that path (e.g. the open() 
system call.) The system call has no idea where that path string came from.

You could conceivably create a fake volume in the filesystem that didn’t 
correspond to any real file but just returned your data when read (something 
like what the disk images driver does) … but the moment you did this, your data 
would exist in the filesystem and would be accessible to any other process that 
tried to open and read the same path.

—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