[CODE] MacOS X code to execute shell command with administrator priviledges
jerry.daniels at me.com
Wed Jun 30 09:40:30 CDT 2010
Great stuff, Andre, thanks!
On Jun 30, 2010, at 9:16 AM, Andre Garzia wrote:
> I just created a tiny function that I think might be useful for people here.
> Sometimes you want to execute a command with shell() on mac os x but your
> command needs to be run with administrator priviledges. Some might try to
> script sudo to do this or just give up because scripting sudo is not that
> easy. Well, it turns out there's a simpler solution using applescript. So
> here it is:
> function executeWithPriviledges pCmd
> do format("do shell script \"%s\" with administrator privileges", pCmd)
> as applescript
> return the result
> end executeWithPriviledges
> also available at http://wecode.org/paste/A9HF2D6
> This function will execute the command passed to it with administrator
> priviledges, it will display the standard mac os x dialog box for
> authorization. It uses applescript that in taps into Mac OS X Authorization
> Services API.
> It think it is useful, specially for all those people running "apachectl
> graceful" from inside rev (is it just me?)
> http://www.andregarzia.com All We Do Is Code.
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
More information about the use-livecode