shell() and sudo

Alex Rice alrice at ARCplanning.com
Mon May 19 09:22:01 EDT 2003


On Monday, May 19, 2003, at 01:00  AM, Jeanne A. E. DeVoto wrote:
>> """
>> On OS X systems, you can use the open process command to start up an
>> application, but not a Unix process. To work with a Unix process, use
>> the shell function instead.
>> """
>> Support for using the open process command on OS X systems was added 
>> in
>> version 2.0.
>
> Can you give me an idea of how this could more clearly express this? 
> Thanks.

Glad to help,

On OS X, open process is NOT implemented in version 2.0 (I'm going on 
what Geoff Canyon told me off-list.) Instead open process is just doing 
what the "launch" command does. So I would remove the sentence "Support 
for using the open process command on OS X systems was added" and 
replace it with "On OS X, open process command with stdio (for 
write/update) capabilities will be added in the future."

I would change the sentence "To work with a Unix process, use the shell 
function instead." to ... um ... something to acknowledge the 
difference between "open process" and "shell"- that shell is a one-off 
command but with open process you get a process id back and could read 
and write to it repeatedly.

It would also be helpful to have some discussion in there of how STDIN, 
STDOUT and STDERR fits into the framework of these commands. shell() 
talks about it a little, but open process does not. For example, if 
there process writes to STDERR, does it always end up in "the result"? 
or is it sometimes merged in with the output, like it is with shell().?

Would be helpful to have some examples showing error handling and where 
the input/output/error goes:

put shell("something STDIN...") into tOut
put shell("STDIN... | something") into tOut
put shell("something < STDIN...") into tOut
-- tOut includes STDOUT & STDERR too on unix

get open process "app" into tProc
write "STDIN..." to tProc
read "STDOUT" from process until eof
if the result <> empty then
  put "STDERR" && the result after message -- guessing here
end if
-- some processes write to STDERR repeatedly. How would you capture 
that?



Thanks,

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






More information about the use-livecode mailing list