lc shell and command line
Mike Bonner
bonnmike at gmail.com
Mon Nov 14 15:16:39 EST 2011
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
More information about the use-livecode
mailing list