I have a program that writes to stdout in a batch of text very quickly, but the output doesn't have a specific output that I can write an expect loop for. Example of stdout of my program:
[time:here] random text 1
[time:here] random text 2
[time:here] random text 3
[time:here] random text 4
[time:here] random text 5
[time:here] random text 6
[time:here] random text 7
Then it waits until I interact with it, and then it writes to stdout again with the same style of text:
[time:here] random text 8
[time:here] random text 9
[time:here] random text 10
[time:here] random text 11
[time:here] random text 12
[time:here] random text 13
[time:here] random text 14
The stdout is printed very fast, like within milliseconds, and then there's a wait until I interact with it. Once I interact stdout is written again very quick, and it waits. This repeats until I close the program.
Between the waits I want to send a command to write to another file what time I interacted with the program at (using echo or something similar).
Is there any way I can target the "wait" and do the echo command after every time there's a wait for my stdout? For example if there's a wait for > than 5 seconds then run the echo command, and wait for stdout to change again?
expectcan handle atimeoutevent for bothexpectloops and when ininteractmode, is there a reason those won't fly?