[Gambas-user] How to create a graphical tail-like function

Rob sourceforge-raindog2 at ...94...
Fri Jul 11 18:38:33 CEST 2003


On Wednesday 09 July 2003 07:59, Lasse Kim Christiansen wrote:
> My initial problem is how i should create the tail function. Which will
> open a file and continuously print new lines as they end up in the syslog.

Well, it's a little more than just a function, but you could just do

EXEC [ "tail", "-f", "/var/log/syslog" ] FOR READ AS MyProcess

and then

public sub Process_Write(Data as string)
	' append the data to whatever display control you're using, and then...
	if Data like "somepattern" then Message.info(data)
end

Of course you could probably do things easier with the watched files 
functionality which I haven't tried yet.

Benoit, I noticed when messing with that perl regex thing that the 
Process.Write event seems to be static, i.e. it calls Process_Write back 
rather than (for example) MyProcess_Write.  So if you have more than one 
process open all the output would end up in the same handler function.  Is 
this right?

Rob





More information about the User mailing list