shell command callback question

Josh Mellicker josh at dvcreators.net
Fri Apr 25 15:54:10 EDT 2008


I have just one more question on this:

Is there any empirical way to determine when a shell process has  
completed?

(Other than trying to figure it out by parsing the returned text)

This would be analogous, I guess, to when in Terminal, it returns you  
to the regular prompt.


On Apr 24, 2008, at 2:19 AM, Mark Smith wrote:

> Josh, there's a couple of ways to deal with this, but, as of 2.9, at  
> last we can read and write interactively to processes on OS X, so I  
> do things like this:
>
>
> to encode an audio file with the flac command line encoder,
>
> on flacEncode pInfile, pOutfile
>  put "flac" && pInfile && "-o" && pOutfile into tProc
>  open process tProc for update -- this starts the process working
>
> -- this is often better done with a "send in time" handler and a  
> callback
> -- but shows how it works
>
>  put 0 into tPercDone
>  repeat until tPercDone = 100
>    wait 250 millisecs with messages
>    read from process tProc until empty
>    put it into tProcOutput
>    ...
>    statements to parse out the percentage complete from tProcOutput
>   ...
>   put tPercDone
>  end repeat
>  close process tProc
>
> end flacEncode
>
> -------
>
> Another option is to open "/bin/bash" as a process, so you can then  
> read and write to it as if it were  the 'terminal' app.
>
> best,
>
> Mark
>
>
> On 24 Apr 2008, at 05:33, Josh Mellicker wrote:
>> When you execute a shell command in Terminal in OS X, (in  
>> appropriate cases) you get text back as the command executes. For  
>> example, when searching a hard drive, even though the entire  
>> process takes a while, at each moment it finds a matching file, it  
>> echoes it to the terminal, so you get a little feedback while  
>> you're waiting.
>>
>> However, in Revolution, when I execute a shell command, nothing is  
>> returned until the entire command is finishing executing, at which  
>> point I get all the echoed text at once.
>>
>> I am brand new at this and probably missing something obvious...  
>> how do you set up a callback so you get the echoed text in "real  
>> time"?
>> _______________________________________________
>> use-revolution mailing list
>> use-revolution at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your  
>> subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-revolution
>
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your  
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-revolution




More information about the use-livecode mailing list