open elevated process seems to work ok. The following handler, opens bash
as an elevated process, then writes to it and reads from it.  Should be
possible to run a pre-made shell script too.

Yep, just tried it works fine. Notice the "whoami" command that is written,
it confirms that using open elevated process does indeed = root.


on mouseUp
   put "/bin/bash" into tProcess
   open elevated process tProcess for text update -- opens a shell with
elevated privs

   -- writes commands to the shell. Here I change owner of a file to root,
   --then later list it in field 1 as proof that it was done
   write "chown root test.fil;ls -l test.fil" & return  to process tProcess

   -- makes sure there was time to complete the command before reading
   wait 15 milliseconds

   --this does just what it says
   read from process tProcess until empty
   put it & return into field 1

   -- another check. Should show root as who I am.
   write "whoami" & return to process tProcess
   wait 15 milliseconds

   -- get the results
   read from process tProcess until empty
   put it & return after field 1

   close process tProcess
end mouseUp
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to