Is there anyway to run a process in the background while showing the real time updates in the stdout
and only saving the last line (tail -n 1 savefile
) to a file? There can be anywhere between 1 and 15 tests running at the same time and I need to be able to see that the tests are running but I do not want to save the entire text output.
I should mention since the tests are running in the background I am using a checkpid
loop to wait for the tests to finish
also if it helps this is how my script is running the tests...
set runtest [exec -ignorestderr bsub -I -q lin_i make $testvar SEED=1 VPDDUMP=on |tail -n 1 >> $path0/runtestfile &]
I have found that if I use | tee
it causes the checkpid
loop to skip but if I do |tee
it does not display output.
It's going to be better to use a simpler pipeline with explicit management of the output handling in Tcl, instead of using
tail -n
(andtee
) to simulate it.This code, plus a little
vwait
to enable event-based processing (assuming you're not also using Tk), will let you read from the pipeline while not preventing you from doing other things. You can even fire off multiple pipelines at once; Tcl will cope just fine. What's more, setting a writetrace
on the::status
array will let you monitor for changes across all of the pipelines at once.