shell() and sudo

Alex Rice alrice at ARCplanning.com
Wed May 14 08:06:01 EDT 2003


On Wednesday, May 14, 2003, at 01:11  AM, Rolf Kocherhans wrote:

> Hello Alex
>
> Thaks for your post I tried what you suggested but had no luck so far !
>
> Have you done something similar already or could you help me with this 
> ?
>
> all I trie to do is a "sudo ls" which then asks for "Password:" after 
> typing it in
> the  will procedd in the Terminal Application but I dont know how to 
> do it in Revolution.
>
> Do you know anything about STDIN and STDOUT could that help ?

Rolf- what platform are you using? On Rev 1.1.1 on Win32, open process 
and read from process seem to work OK. On Mac OS X, using Rev 2.0 rc1, 
it doesn't work. The release notes say it's supposed to work. I'll file 
a bug report.

on mouseup
   open process "/bin/ls" for read
   put the result & linefeed after message -- on OS X this gives "error 
-50"
   put the openProcessIDs & linefeed after message
   put the openProcesses & linefeed after message
   read from process "/bin/ls" until EOF
   answer info it titled "/bin/ls output"
end mouseup

Rolf- probably you are going to need "/usr/bin/sudo ls" to give the 
path to the process you want to start. You can find the path by typing 
"which ls" into the terminal.

Rolf- re: STDIN and STDOUT. Most (all?) process have STDIN STDOUT and 
STDERR. STDIN is input, STDOUT is ouput and STDERR is an output 
channel. read from process should give you STDOUT. write to process 
should write to STDIN. "the result" should give you STDERR. I don't 
know where STDERR goes when you are interactively reading and writing a 
process

Rolf- re: sudo the process doesn't end immediately so "until EOF" isn't 
going to work. Maybe "until "Password:" prompt something.

Alex Rice, Software Developer
Architectural Research Consultants, Inc.
alrice at ARCplanning.com
alrice at swcp.com






More information about the use-livecode mailing list