Re: NSTask arguments
Re: NSTask arguments
- Subject: Re: NSTask arguments
- From: Jens Alfke <email@hidden>
- Date: Wed, 20 Feb 2013 20:11:15 -0800
On Feb 20, 2013, at 4:18 PM, email@hidden 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 (email@hidden)
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:
This email sent to email@hidden