Shell command doesn't give feedback until done
Sarah Reichelt
sarahr at genesearch.com.au
Mon Jun 20 20:18:12 EDT 2005
> The ampersand doesn't seem to work to run asynchronously.
>
Hi Bill,
Don't ask me to explain this one, but I mashed it together using some
hints on various web sites and it does work asynchronously :-)
This is from a handler I use to ping a remote computer and it uses
the ping command but doesn't wait for the result, instead reads it
later from the file created by the command.
on startPingCheck pIP
-- delete any existing result file
put specialFolderPath("Desktop") & "/ping.txt" into tFileName
if there is a file tFileName then delete file tFileName
-- construct a command line and send it to the shell
put "ping -c1 -n " & pIP into tShellCmd
put " > " & tFileName & " 2>&1 &" after tShellCmd
get shell(tShellCmd)
-- set up routine to keep checking for the result file
-- read & parse the result when it appears
send "checkForPingFile" to me in 1 second
end startPingCheck
If anyone can explain the "2>&1" section of the command, I would be
most interested :-)
It seems to be critical but I have no idea why!
Sarah
More information about the use-livecode
mailing list