[Gambas-user] Delete a file requiring Admin privilege
John Rose
john.aaron.rose at ...626...
Sun Feb 3 18:53:47 CET 2013
Tobias,
You were correct:
Exec ["gksudo", Shell$("desktop-file-install " & Shell$(sPath))]
did not work.
I've posted this as issue #400 on
https://code.google.com/p/gambas/issues. It'll be interesting to see
Benoit's take on this. Unless there's a solution/workaround, it looks
like it's best to use Shell when using gksudo.
Regards,
John
On 03/02/13 15:39, Tobias Boege wrote:
> On Sun, 03 Feb 2013, John Rose wrote:
>> I've just tried using Exec with "gksudo" and having only one
>> concatenated parameter:
>> Exec ["gksudo", "desktop-file-install " & "--dir=" & sInstallDirectory &
>> " " & sPath] To sOutput
>>
>> It gave no errors but it didn't work.
>>
>> I was using Shell and that worked with Shell$ applied to the directory
>> and path variables above. But I thought that I'd try using Exec as the
>> equivalent gksudo command to the above can be run in Terminal i.e. not
>> using bash.
> So, putting it all together, I _suppose_ that the following happens:
>
> - gksudo takes the command to execute and all its parameters in one single
> argument.
> - it elevates its privileges and calls the shell to execute the command
> given.
>
> Consequently the following may work:
>
> Exec ["gksudo", Shell$("desktop-file-install " & Shell$(sPath))]
>
> I read about some hacks in the code which would allow you to use "--" to
> separate arguments to gksudo and the program being called. Maybe you can
> experiment a little bit if the above does not work (I fear it). If, on the
> other side, it does work, then I would suggest using the Shell instruction
> instead of Exec :-)
>
> Regards,
> Tobi
>
> ------------------------------------------------------------------------------
> Everyone hates slow websites. So do we.
> Make your web apps faster with AppDynamics
> Download AppDynamics Lite for free today:
> http://p.sf.net/sfu/appdyn_d2d_jan
> _______________________________________________
> Gambas-user mailing list
> Gambas-user at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gambas-user
More information about the User
mailing list