There are a couple options here. First thing to note is that shell is blocking. So if you are running a really long shell script, nothing else can or will occur until it is done. (if i'm mistaken, someone correct me)
Now, if you're running the shell script from a terminal and just want to check your log file from LC that should be easy enough to implement. If you want a more interactive/non-blocking approach to run your script from within livecode, you might look at "open process" alternatively could probably break up your long shell script and run each part of it one at a time using shell (meaning forget a script file, do each individual line from within lc using shell() then update your log after each step completes)
open process is probably the easiest.
As for exiting repeats you can use 'exit repeat'
repeat until condition
if some other condition we want to break on then
exit repeat
end if
end repeat
During development I usually put a line like
if the shiftkey is down then exit repeat
so that I just have to hold shift until the next loop and it will exit.
If you go with open process instead of shell you'll need to set up a read loop
Something like..
Code: Select all
command readloop
if conditionthatmeanskeeplooping then
read from myprocess until empty
-- could put a check to see if the process is done here, if so change the condition
put it after field "log"
send readLoop to me in 1 tick
end if
end readloop
If you'd rather just redirect output to a file like you mentioned and then poll the file you can open process "/path/to/executable" for neither -- neither meaning no input or output just launch it.
At which point you'll still need some type of loop to check the file contents for change. Repeat or a send in time loop should be fine.